Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Nov 22, 2023
1 parent 1bdcb49 commit 2136543
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 3 additions & 4 deletions base_layer/core/src/transactions/coinbase_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tari_common_types::{
tari_address::TariAddress,
types::{Commitment, PrivateKey, PublicKey},
};
use tari_crypto::keys::{PublicKey as PK, SecretKey};
use tari_crypto::keys::PublicKey as PK;
use tari_key_manager::key_manager_service::{KeyManagerInterface, KeyManagerServiceError};
use tari_script::{one_sided_payment_script, stealth_payment_script, ExecutionStack, TariScript};
use tari_utilities::ByteArrayError;
Expand Down Expand Up @@ -382,9 +382,8 @@ pub async fn generate_coinbase(
stealth_payment: bool,
consensus_constants: &ConsensusConstants,
) -> Result<(TransactionOutput, TransactionKernel), CoinbaseBuildError> {
// The random script key is to ensure that it is not known to the caller, and it is also not used
// in the Diffie-Hellmann protocol.
let script_key_id = key_manager.import_key(PrivateKey::random(&mut OsRng)).await?;
// The script key is not used in the Diffie-Hellmann protocol, so we assign default.
let script_key_id = TariKeyId::default();
let (_, coinbase_output, coinbase_kernel, _) = generate_coinbase_with_wallet_output(
fee,
reward,
Expand Down
10 changes: 3 additions & 7 deletions base_layer/wallet/tests/transaction_service_tests/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,10 @@ pub async fn test_db_backend<T: TransactionBackend + 'static>(backend: T) {
panic!("Should have found cancelled outbound tx");
}

// Transactions with empty kernel signatures should not be returned with this method, as those will be considered
// as faux transactions (imported or one-sided)
let unmined_txs = db.fetch_unconfirmed_transactions_info().unwrap();

assert_eq!(unmined_txs.len(), 4);

db.set_transaction_as_unmined(completed_txs[0].tx_id).unwrap();

let unmined_txs = db.fetch_unconfirmed_transactions_info().unwrap();
assert_eq!(unmined_txs.len(), 5);
assert_eq!(unmined_txs.len(), 0);
}

#[tokio::test]
Expand Down

0 comments on commit 2136543

Please sign in to comment.