Skip to content

Commit 6346536

Browse files
committed
test(wallet): small cleanups to test_wallet_transactions_relevant
Also small use cleanup in wallet/mod.
1 parent 03a08bb commit 6346536

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

crates/wallet/src/wallet/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use alloc::{
1919
sync::Arc,
2020
vec::Vec,
2121
};
22-
use chain::Indexer;
2322
use core::{cmp::Ordering, fmt, mem, ops::Deref};
2423

2524
use bdk_chain::{
@@ -32,7 +31,7 @@ use bdk_chain::{
3231
},
3332
tx_graph::{CalculateFeeError, CanonicalTx, TxGraph, TxUpdate},
3433
BlockId, ChainPosition, ConfirmationBlockTime, DescriptorExt, FullTxOut, Indexed,
35-
IndexedTxGraph, Merge,
34+
IndexedTxGraph, Indexer, Merge,
3635
};
3736
use bitcoin::{
3837
absolute,

crates/wallet/tests/wallet.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::sync::Arc;
44

55
use anyhow::Context;
66
use assert_matches::assert_matches;
7-
use bdk_chain::{BlockId, ChainPosition, ConfirmationBlockTime, TxUpdate};
7+
use bdk_chain::{BlockId, ChainPosition, ConfirmationBlockTime};
88
use bdk_wallet::coin_selection::{self, LargestFirstCoinSelection};
99
use bdk_wallet::descriptor::{calc_checksum, DescriptorError, IntoWalletDescriptor};
1010
use bdk_wallet::error::CreateTxError;
@@ -4254,22 +4254,13 @@ fn test_wallet_transactions_relevant() {
42544254
// add not relevant transaction to test wallet
42554255
let (other_external_desc, other_internal_desc) = get_test_tr_single_sig_xprv_and_change_desc();
42564256
let (other_wallet, other_txid) = get_funded_wallet(other_internal_desc, other_external_desc);
4257-
let other_tx_node = other_wallet.get_tx(other_txid).unwrap().tx_node;
4258-
let other_tx_confirmationblocktime = other_tx_node.anchors.iter().last().unwrap();
4259-
let other_tx_update = TxUpdate {
4260-
txs: vec![other_tx_node.tx],
4261-
txouts: Default::default(),
4262-
anchors: [(*other_tx_confirmationblocktime, other_txid)].into(),
4263-
seen_ats: [(other_txid, other_tx_confirmationblocktime.confirmation_time)].into(),
4264-
};
42654257
let test_wallet_update = Update {
4266-
last_active_indices: Default::default(),
4267-
tx_update: other_tx_update,
4268-
chain: None,
4258+
tx_update: other_wallet.tx_graph().clone().into(),
4259+
..Default::default()
42694260
};
42704261
test_wallet.apply_update(test_wallet_update).unwrap();
42714262

4272-
// verify transaction from other wallet was added but is not it relevant transactions list.
4263+
// verify transaction from other wallet was added but is not in relevant transactions list.
42734264
let relevant_tx_count_after = test_wallet.transactions().count();
42744265
let full_tx_count_after = test_wallet.tx_graph().full_txs().count();
42754266
let canonical_tx_count_after = test_wallet

0 commit comments

Comments
 (0)