Skip to content

Commit a055581

Browse files
committed
feat(chain): KeychainTxOutIndex: Make spk cache optional
Also added staging changes to `ChangeSet::spk_cache`. This way, we can avoid returning `ChangeSet`s for `apply_changeset` and `insert_descriptor`. * `KeychainTxOutIndex::new` now takes in an additional `use_spk_cache` parameter. * Fixed `reveal_to_target` method to actually return `None` if the keychain does not exist.
1 parent 19e3b5d commit a055581

File tree

7 files changed

+204
-175
lines changed

7 files changed

+204
-175
lines changed

crates/bitcoind_rpc/examples/filter_iter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ fn main() -> anyhow::Result<()> {
3333
let (mut chain, _) = LocalChain::from_genesis_hash(genesis_block(NETWORK).block_hash());
3434
let mut graph = IndexedTxGraph::<ConfirmationBlockTime, KeychainTxOutIndex<&str>>::new({
3535
let mut index = KeychainTxOutIndex::default();
36-
// TODO: Properly deal with these changesets.
37-
let _ = index.insert_descriptor("external", descriptor.clone())?;
38-
let _ = index.insert_descriptor("internal", change_descriptor.clone())?;
36+
index.insert_descriptor("external", descriptor.clone())?;
37+
index.insert_descriptor("internal", change_descriptor.clone())?;
3938
index
4039
});
4140

crates/chain/benches/canonicalization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ fn setup<F: Fn(&mut KeychainTxGraph, &LocalChain)>(f: F) -> (KeychainTxGraph, Lo
8282

8383
let (desc, _) =
8484
<Descriptor<DescriptorPublicKey>>::parse_descriptor(&Secp256k1::new(), DESC).unwrap();
85-
let mut index = KeychainTxOutIndex::new(10);
86-
let _ = index.insert_descriptor((), desc).unwrap();
85+
let mut index = KeychainTxOutIndex::new(10, true);
86+
index.insert_descriptor((), desc).unwrap();
8787
let mut tx_graph = KeychainTxGraph::new(index);
8888

8989
f(&mut tx_graph, &chain);

0 commit comments

Comments
 (0)