refactor: Remove scan and scan_txout from SpkTxoutIndex and KeychainTxoutIndex

This commit is contained in:
Vladimir Fomene
2023-08-25 12:52:09 +03:00
committed by 志宇
parent 32c40ac939
commit c56728ff13
5 changed files with 55 additions and 84 deletions

View File

@@ -4,6 +4,7 @@
mod common;
use bdk_chain::{
collections::BTreeMap,
indexed_tx_graph::Indexer,
keychain::{self, KeychainTxOutIndex},
Append,
};
@@ -194,7 +195,7 @@ fn test_lookahead() {
],
..common::new_tx(external_index)
};
assert_eq!(txout_index.scan(&tx), keychain::ChangeSet::default());
assert_eq!(txout_index.index_tx(&tx), keychain::ChangeSet::default());
assert_eq!(
txout_index.last_revealed_index(&TestKeychain::External),
Some(last_external_index)
@@ -248,7 +249,7 @@ fn test_scan_with_lookahead() {
value: 0,
};
let changeset = txout_index.scan_txout(op, &txout);
let changeset = txout_index.index_txout(op, &txout);
assert_eq!(
changeset.as_inner(),
&[(TestKeychain::External, spk_i)].into()
@@ -273,7 +274,7 @@ fn test_scan_with_lookahead() {
script_pubkey: spk_41,
value: 0,
};
let changeset = txout_index.scan_txout(op, &txout);
let changeset = txout_index.index_txout(op, &txout);
assert!(changeset.is_empty());
}

View File

@@ -1,4 +1,4 @@
use bdk_chain::SpkTxOutIndex;
use bdk_chain::{indexed_tx_graph::Indexer, SpkTxOutIndex};
use bitcoin::{absolute, OutPoint, ScriptBuf, Transaction, TxIn, TxOut};
#[test]
@@ -22,7 +22,7 @@ fn spk_txout_sent_and_received() {
assert_eq!(index.sent_and_received(&tx1), (0, 42_000));
assert_eq!(index.net_value(&tx1), 42_000);
index.scan(&tx1);
index.index_tx(&tx1);
assert_eq!(
index.sent_and_received(&tx1),
(0, 42_000),
@@ -82,7 +82,7 @@ fn mark_used() {
}],
};
spk_index.scan(&tx1);
spk_index.index_tx(&tx1);
spk_index.unmark_used(&1);
assert!(
spk_index.is_used(&1),