Split get_tx into its own trait

to make supporting verify_tx easier
This commit is contained in:
LLFourn
2022-02-23 10:38:35 +11:00
parent dcd90f8b61
commit c0e75fc1a8
10 changed files with 65 additions and 69 deletions

View File

@@ -1097,7 +1097,7 @@ macro_rules! bdk_blockchain_tests {
// 2.
// Core (#2) -> Us (#4)
let (wallet, _, mut test_client) = init_single_sig();
let (wallet, blockchain, _, mut test_client) = init_single_sig();
let bdk_address = wallet.get_address(AddressIndex::New).unwrap().address;
let core_address = test_client.get_new_address(None, None).unwrap();
let tx = testutils! {
@@ -1108,7 +1108,7 @@ macro_rules! bdk_blockchain_tests {
let txid_1 = test_client.receive(tx);
let tx_1: Transaction = deserialize(&test_client.get_transaction(&txid_1, None).unwrap().hex).unwrap();
let vout_1 = tx_1.output.into_iter().position(|o| o.script_pubkey == core_address.script_pubkey()).unwrap() as u32;
wallet.sync(noop_progress(), None).unwrap();
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
let tx_1 = wallet.list_transactions(false).unwrap().into_iter().find(|tx| tx.txid == txid_1).unwrap();
assert_eq!(tx_1.received, 50_000);
assert_eq!(tx_1.sent, 0);
@@ -1119,7 +1119,7 @@ macro_rules! bdk_blockchain_tests {
};
let txid_2 = test_client.receive(tx);
wallet.sync(noop_progress(), None).unwrap();
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
let tx_2 = wallet.list_transactions(false).unwrap().into_iter().find(|tx| tx.txid == txid_2).unwrap();
assert_eq!(tx_2.received, 10_000);
assert_eq!(tx_2.sent, 0);