@@ -24,7 +24,7 @@ use bitcoincore_rpc::RpcApi;
24
24
pub fn test_sync_local_chain ( ) -> anyhow:: Result < ( ) > {
25
25
let env = TestEnv :: new ( ) ?;
26
26
let network_tip = env. rpc_client ( ) . get_block_count ( ) ?;
27
- let ( mut local_chain, _) = LocalChain :: from_genesis_hash ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
27
+ let ( mut local_chain, _) = LocalChain :: from_genesis ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
28
28
let mut emitter = Emitter :: new (
29
29
env. rpc_client ( ) ,
30
30
local_chain. tip ( ) ,
@@ -155,7 +155,7 @@ fn test_into_tx_graph() -> anyhow::Result<()> {
155
155
156
156
env. mine_blocks ( 101 , None ) ?;
157
157
158
- let ( mut chain, _) = LocalChain :: from_genesis_hash ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
158
+ let ( mut chain, _) = LocalChain :: from_genesis ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
159
159
let mut indexed_tx_graph = IndexedTxGraph :: < BlockId , _ > :: new ( {
160
160
let mut index = SpkTxOutIndex :: < usize > :: default ( ) ;
161
161
index. insert_spk ( 0 , addr_0. script_pubkey ( ) ) ;
@@ -255,10 +255,7 @@ fn ensure_block_emitted_after_reorg_is_at_reorg_height() -> anyhow::Result<()> {
255
255
let env = TestEnv :: new ( ) ?;
256
256
let mut emitter = Emitter :: new (
257
257
env. rpc_client ( ) ,
258
- CheckPoint :: new ( BlockId {
259
- height : 0 ,
260
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
261
- } ) ,
258
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
262
259
EMITTER_START_HEIGHT as _ ,
263
260
NO_EXPECTED_MEMPOOL_TXIDS ,
264
261
) ;
@@ -289,7 +286,7 @@ fn process_block(
289
286
block : Block ,
290
287
block_height : u32 ,
291
288
) -> anyhow:: Result < ( ) > {
292
- recv_chain. apply_update ( CheckPoint :: from_header ( & block. header , block_height) ) ?;
289
+ recv_chain. apply_header ( & block. header , block_height) ?;
293
290
let _ = recv_graph. apply_block ( block, block_height) ;
294
291
Ok ( ( ) )
295
292
}
@@ -337,10 +334,7 @@ fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
337
334
let env = TestEnv :: new ( ) ?;
338
335
let mut emitter = Emitter :: new (
339
336
env. rpc_client ( ) ,
340
- CheckPoint :: new ( BlockId {
341
- height : 0 ,
342
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
343
- } ) ,
337
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
344
338
0 ,
345
339
NO_EXPECTED_MEMPOOL_TXIDS ,
346
340
) ;
@@ -354,7 +348,7 @@ fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
354
348
let addr_to_track = Address :: from_script ( & spk_to_track, bitcoin:: Network :: Regtest ) ?;
355
349
356
350
// setup receiver
357
- let ( mut recv_chain, _) = LocalChain :: from_genesis_hash ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
351
+ let ( mut recv_chain, _) = LocalChain :: from_genesis ( env. rpc_client ( ) . get_block_hash ( 0 ) ?) ;
358
352
let mut recv_graph = IndexedTxGraph :: < BlockId , _ > :: new ( {
359
353
let mut recv_index = SpkTxOutIndex :: default ( ) ;
360
354
recv_index. insert_spk ( ( ) , spk_to_track. clone ( ) ) ;
@@ -429,10 +423,7 @@ fn mempool_avoids_re_emission() -> anyhow::Result<()> {
429
423
let env = TestEnv :: new ( ) ?;
430
424
let mut emitter = Emitter :: new (
431
425
env. rpc_client ( ) ,
432
- CheckPoint :: new ( BlockId {
433
- height : 0 ,
434
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
435
- } ) ,
426
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
436
427
0 ,
437
428
NO_EXPECTED_MEMPOOL_TXIDS ,
438
429
) ;
@@ -496,10 +487,7 @@ fn mempool_re_emits_if_tx_introduction_height_not_reached() -> anyhow::Result<()
496
487
let env = TestEnv :: new ( ) ?;
497
488
let mut emitter = Emitter :: new (
498
489
env. rpc_client ( ) ,
499
- CheckPoint :: new ( BlockId {
500
- height : 0 ,
501
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
502
- } ) ,
490
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
503
491
0 ,
504
492
NO_EXPECTED_MEMPOOL_TXIDS ,
505
493
) ;
@@ -588,10 +576,7 @@ fn mempool_during_reorg() -> anyhow::Result<()> {
588
576
let env = TestEnv :: new ( ) ?;
589
577
let mut emitter = Emitter :: new (
590
578
env. rpc_client ( ) ,
591
- CheckPoint :: new ( BlockId {
592
- height : 0 ,
593
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
594
- } ) ,
579
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
595
580
0 ,
596
581
NO_EXPECTED_MEMPOOL_TXIDS ,
597
582
) ;
@@ -716,10 +701,7 @@ fn no_agreement_point() -> anyhow::Result<()> {
716
701
// start height is 99
717
702
let mut emitter = Emitter :: new (
718
703
env. rpc_client ( ) ,
719
- CheckPoint :: new ( BlockId {
720
- height : 0 ,
721
- hash : env. rpc_client ( ) . get_block_hash ( 0 ) ?,
722
- } ) ,
704
+ CheckPoint :: new ( 0 , env. rpc_client ( ) . get_block_hash ( 0 ) ?) ,
723
705
( PREMINE_COUNT - 2 ) as u32 ,
724
706
NO_EXPECTED_MEMPOOL_TXIDS ,
725
707
) ;
@@ -791,7 +773,7 @@ fn test_expect_tx_evicted() -> anyhow::Result<()> {
791
773
. 0 ;
792
774
let spk = desc. at_derivation_index ( 0 ) ?. script_pubkey ( ) ;
793
775
794
- let mut chain = LocalChain :: from_genesis_hash ( genesis_block ( Network :: Regtest ) . block_hash ( ) ) . 0 ;
776
+ let mut chain = LocalChain :: from_genesis ( genesis_block ( Network :: Regtest ) . block_hash ( ) ) . 0 ;
795
777
let chain_tip = chain. tip ( ) . block_id ( ) ;
796
778
797
779
let mut index = SpkTxOutIndex :: default ( ) ;
@@ -808,7 +790,7 @@ fn test_expect_tx_evicted() -> anyhow::Result<()> {
808
790
let mut emitter = Emitter :: new ( env. rpc_client ( ) , chain. tip ( ) , 1 , HashSet :: from ( [ txid_1] ) ) ;
809
791
while let Some ( emission) = emitter. next_block ( ) ? {
810
792
let height = emission. block_height ( ) ;
811
- chain. apply_update ( CheckPoint :: from_header ( & emission. block . header , height) ) ?;
793
+ chain. apply_header ( & emission. block . header , height) ?;
812
794
}
813
795
814
796
let changeset = graph. batch_insert_unconfirmed ( emitter. mempool ( ) ?. new_txs ) ;
0 commit comments