File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ use bitcoin:: key:: Secp256k1 ;
2+ use criterion:: { criterion_group, criterion_main, Criterion } ;
3+ use miniscript:: { Descriptor , DescriptorPublicKey } ;
4+ use bdk_chain:: { DescriptorExt , Indexer } ;
5+ use bdk_chain:: keychain_txout:: { ChangeSet , KeychainTxOutIndex } ;
6+
7+ #[ test]
8+ fn cache_and_load_spks ( target_index : u32 ) {
9+ const DESC : & str = "tr([ab28dc00/86h/1h/0h]tpubDCdDtzAMZZrkwKBxwNcGCqe4FRydeD9rfMisoi7qLdraG79YohRfPW4YgdKQhpgASdvh612xXNY5xYzoqnyCgPbkpK4LSVcH5Xv4cK7johH/0/*)" ;
10+
11+ let ( desc, _) =
12+ <Descriptor < DescriptorPublicKey > >:: parse_descriptor ( & Secp256k1 :: new ( ) , DESC ) . unwrap ( ) ;
13+ let mut txout_index = KeychainTxOutIndex :: new ( 0 , false ) ;
14+ txout_index. insert_descriptor ( ( ) , desc. clone ( ) ) . unwrap ( ) ;
15+ let lookahead_changeset = txout_index. lookahead_to_target ( ( ) , target_index) ;
16+ dbg ! ( & lookahead_changeset) ;
17+ }
18+
19+ fn criterion_benchmark ( c : & mut Criterion ) {
20+ c. bench_function ( "fib 20" , |b| b. iter ( || fibonacci ( black_box ( 20 ) ) ) ) ;
21+ }
22+
23+ criterion_group ! ( benches, criterion_benchmark) ;
24+ criterion_main ! ( benches) ;
You can’t perform that action at this time.
0 commit comments