Skip to content

Commit 642f5af

Browse files
committed
f rename + better document test parameter
1 parent cc7d658 commit 642f5af

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9262,7 +9262,7 @@ fn test_invalid_funding_tx() {
92629262
assert_eq!(nodes[1].node.list_channels().len(), 0);
92639263
}
92649264

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) {
92669266
// In the first version of the chain::Confirm interface, after a refactor was made to not
92679267
// broadcast CSV-locked transactions until their CSV lock is up, we wouldn't reliably broadcast
92689268
// 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
92769276
// height at which transactions were confirmed to `OnchainTx::update_claims_view`, it wasn't
92779277
// aware that the anti-reorg-delay had, in fact, already expired, waiting to fail-backwards
92789278
// 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).
92799282
let chanmon_cfgs = create_chanmon_cfgs(3);
92809283
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
92819284
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
92959298
assert_eq!(node_txn.len(), 1);
92969299

92979300
let conf_height = nodes[1].best_block_info().1;
9298-
if !check_no_broadcast_too_early {
9301+
if !test_height_before_timelock {
92999302
connect_blocks(&nodes[1], 24 * 6);
9300-
} else {
9301-
// As an additional check, test that we aren't broadcasting transactions too early, either
93029303
}
93039304
nodes[1].chain_monitor.chain_monitor.transactions_confirmed(
93049305
&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 {
93069307
// If we confirmed the close transaction, but timelocks have not yet expired, we should not
93079308
// generate any events or broadcast any transactions
93089309
assert!(nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().is_empty());

0 commit comments

Comments
 (0)