@@ -230,6 +230,9 @@ fn do_connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: Block, sk
230230 #[ cfg( feature = "std" ) ] {
231231 eprintln ! ( "Connecting block using Block Connection Style: {:?}" , * node. connect_style. borrow( ) ) ;
232232 }
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) ) ;
233236 if !skip_intermediaries {
234237 let txdata: Vec < _ > = block. txdata . iter ( ) . enumerate ( ) . collect ( ) ;
235238 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
279282 }
280283 call_claimable_balances ( node) ;
281284 node. node . test_process_background_events ( ) ;
282- node. blocks . lock ( ) . unwrap ( ) . push ( ( block, height) ) ;
283285}
284286
285287pub 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: &
24352437pub fn create_chanmon_cfgs ( node_count : usize ) -> Vec < TestChanMonCfg > {
24362438 let mut chan_mon_cfgs = Vec :: new ( ) ;
24372439 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 ) ;
24422441 let fee_estimator = test_utils:: TestFeeEstimator { sat_per_kw : Mutex :: new ( 253 ) } ;
24432442 let chain_source = test_utils:: TestChainSource :: new ( Network :: Testnet ) ;
24442443 let logger = test_utils:: TestLogger :: with_id ( format ! ( "node {}" , i) ) ;
0 commit comments