@@ -230,6 +230,9 @@ fn do_connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: Block, sk
230
230
#[ cfg( feature = "std" ) ] {
231
231
eprintln ! ( "Connecting block using Block Connection Style: {:?}" , * node. connect_style. borrow( ) ) ;
232
232
}
233
+ // Update the block internally before handing it over to LDK, to ensure our assertions regarding
234
+ // transaction broadcast are correct.
235
+ node. blocks . lock ( ) . unwrap ( ) . push ( ( block. clone ( ) , height) ) ;
233
236
if !skip_intermediaries {
234
237
let txdata: Vec < _ > = block. txdata . iter ( ) . enumerate ( ) . collect ( ) ;
235
238
match * node. connect_style . borrow ( ) {
@@ -279,7 +282,6 @@ fn do_connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: Block, sk
279
282
}
280
283
call_claimable_balances ( node) ;
281
284
node. node . test_process_background_events ( ) ;
282
- node. blocks . lock ( ) . unwrap ( ) . push ( ( block, height) ) ;
283
285
}
284
286
285
287
pub fn disconnect_blocks < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , count : u32 ) {
@@ -2435,10 +2437,7 @@ pub fn fail_payment<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path: &
2435
2437
pub fn create_chanmon_cfgs ( node_count : usize ) -> Vec < TestChanMonCfg > {
2436
2438
let mut chan_mon_cfgs = Vec :: new ( ) ;
2437
2439
for i in 0 ..node_count {
2438
- let tx_broadcaster = test_utils:: TestBroadcaster {
2439
- txn_broadcasted : Mutex :: new ( Vec :: new ( ) ) ,
2440
- blocks : Arc :: new ( Mutex :: new ( vec ! [ ( genesis_block( Network :: Testnet ) , 0 ) ] ) ) ,
2441
- } ;
2440
+ let tx_broadcaster = test_utils:: TestBroadcaster :: new ( Network :: Testnet ) ;
2442
2441
let fee_estimator = test_utils:: TestFeeEstimator { sat_per_kw : Mutex :: new ( 253 ) } ;
2443
2442
let chain_source = test_utils:: TestChainSource :: new ( Network :: Testnet ) ;
2444
2443
let logger = test_utils:: TestLogger :: with_id ( format ! ( "node {}" , i) ) ;
0 commit comments