@@ -9262,7 +9262,7 @@ fn test_invalid_funding_tx() {
9262
9262
assert_eq ! ( nodes[ 1 ] . node. list_channels( ) . len( ) , 0 ) ;
9263
9263
}
9264
9264
9265
- fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast ( check_no_broadcast_too_early : bool ) {
9265
+ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast ( test_height_before_timelock : bool ) {
9266
9266
// In the first version of the chain::Confirm interface, after a refactor was made to not
9267
9267
// broadcast CSV-locked transactions until their CSV lock is up, we wouldn't reliably broadcast
9268
9268
// transactions after a `transactions_confirmed` call. Specifically, if the chain, provided via
@@ -9276,6 +9276,9 @@ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast(check_no_broadcast_t
9276
9276
// height at which transactions were confirmed to `OnchainTx::update_claims_view`, it wasn't
9277
9277
// aware that the anti-reorg-delay had, in fact, already expired, waiting to fail-backwards
9278
9278
// until we learned about an additional block.
9279
+ //
9280
+ // As an additional check, if `test_height_before_timelock` is set, we instead test that we
9281
+ // aren't broadcasting transactions too early (ie not broadcasting them at all).
9279
9282
let chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
9280
9283
let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
9281
9284
let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
@@ -9295,14 +9298,12 @@ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast(check_no_broadcast_t
9295
9298
assert_eq ! ( node_txn. len( ) , 1 ) ;
9296
9299
9297
9300
let conf_height = nodes[ 1 ] . best_block_info ( ) . 1 ;
9298
- if !check_no_broadcast_too_early {
9301
+ if !test_height_before_timelock {
9299
9302
connect_blocks ( & nodes[ 1 ] , 24 * 6 ) ;
9300
- } else {
9301
- // As an additional check, test that we aren't broadcasting transactions too early, either
9302
9303
}
9303
9304
nodes[ 1 ] . chain_monitor . chain_monitor . transactions_confirmed (
9304
9305
& nodes[ 1 ] . get_block_header ( conf_height) , & [ ( 0 , & node_txn[ 0 ] ) ] , conf_height) ;
9305
- if check_no_broadcast_too_early {
9306
+ if test_height_before_timelock {
9306
9307
// If we confirmed the close transaction, but timelocks have not yet expired, we should not
9307
9308
// generate any events or broadcast any transactions
9308
9309
assert ! ( nodes[ 1 ] . tx_broadcaster. txn_broadcasted. lock( ) . unwrap( ) . is_empty( ) ) ;
0 commit comments