Skip to content

Commit 4fc05af

Browse files
committed
Drop height parameter from [dis]connect_block in functional tests
1 parent 580190f commit 4fc05af

File tree

4 files changed

+50
-56
lines changed

4 files changed

+50
-56
lines changed

lightning-persister/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ mod tests {
248248
assert_eq!(node_txn.len(), 1);
249249

250250
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
251-
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[0].clone()]}, CHAN_CONFIRM_DEPTH + 1);
251+
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[0].clone()]});
252252
check_closed_broadcast!(nodes[1], false);
253253
check_added_monitors!(nodes[1], 1);
254254

lightning/src/ln/functional_test_utils.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub fn confirm_transaction_at<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &T
6767
};
6868
let height = starting_block.1 + 1;
6969
assert!(height <= conf_height);
70-
for i in height..conf_height {
71-
connect_block(node, &block, i);
70+
for _ in height..conf_height {
71+
connect_block(node, &block);
7272
block = Block {
7373
header: BlockHeader { version: 0x20000000, prev_blockhash: block.header.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
7474
txdata: vec![],
@@ -79,49 +79,44 @@ pub fn confirm_transaction_at<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &T
7979
block.txdata.push(Transaction { version: 0, lock_time: 0, input: Vec::new(), output: Vec::new() });
8080
}
8181
block.txdata.push(tx.clone());
82-
connect_block(node, &block, conf_height);
82+
connect_block(node, &block);
8383
}
8484

8585
pub fn connect_blocks<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, depth: u32) -> BlockHash {
8686
let mut block = Block {
8787
header: BlockHeader { version: 0x2000000, prev_blockhash: node.best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
8888
txdata: vec![],
8989
};
90-
let height = node.best_block_info().1;
91-
connect_block(node, &block, height + 1);
92-
for i in 2..depth + 1 {
90+
connect_block(node, &block);
91+
for _ in 2..depth + 1 {
9392
block = Block {
9493
header: BlockHeader { version: 0x20000000, prev_blockhash: block.header.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
9594
txdata: vec![],
9695
};
97-
connect_block(node, &block, height + i);
96+
connect_block(node, &block);
9897
}
9998
block.header.block_hash()
10099
}
101100

102-
pub fn connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: &Block, height: u32) {
103-
assert_eq!(height, node.best_block_info().1 + 1); // height is always equal to the parameter we'll fix it at in the next commit
101+
pub fn connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: &Block) {
104102
let txdata: Vec<_> = block.txdata.iter().enumerate().collect();
103+
let height = node.best_block_info().1 + 1;
105104
node.chain_monitor.chain_monitor.block_connected(&block.header, &txdata, height);
106105
node.node.block_connected(&block.header, &txdata, height);
107106
node.node.test_process_background_events();
108107
node.blocks.borrow_mut().push((block.header, height));
109108
}
110109

111-
pub fn disconnect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, header: &BlockHeader, height: u32) {
112-
assert_eq!(height, node.best_block_info().1); // height is always equal to the parameter we'll fix it at in the next commit
113-
node.chain_monitor.chain_monitor.block_disconnected(header, height);
110+
pub fn disconnect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, header: &BlockHeader) {
111+
node.chain_monitor.chain_monitor.block_disconnected(header, node.best_block_info().1);
114112
node.node.block_disconnected(header);
115113
node.blocks.borrow_mut().pop();
116114
}
117115
pub fn disconnect_blocks<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, count: u32) {
118116
assert!(node.blocks.borrow_mut().len() as u32 > count); // Cannot disconnect genesis
119117
for _ in 0..count {
120-
let (block_header, height) = {
121-
let blocks = node.blocks.borrow_mut();
122-
(blocks[blocks.len() - 1].0, blocks[blocks.len() - 1].1)
123-
};
124-
disconnect_block(&node, &block_header, height);
118+
let block_header = node.blocks.borrow().last().unwrap().0;
119+
disconnect_block(&node, &block_header);
125120
}
126121
}
127122

lightning/src/ln/functional_tests.rs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ fn do_test_sanity_on_in_flight_opens(steps: u8) {
442442
header: BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
443443
txdata: vec![],
444444
};
445-
connect_block(&nodes[0], &block, 1);
446-
connect_block(&nodes[1], &block, 1);
445+
connect_block(&nodes[0], &block);
446+
connect_block(&nodes[1], &block);
447447
}
448448

449449
if steps & 0x0f == 0 { return; }
@@ -2803,7 +2803,7 @@ fn test_htlc_on_chain_success() {
28032803

28042804
// Verify that B's ChannelManager is able to extract preimage from HTLC Success tx and pass it backward
28052805
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
2806-
connect_block(&nodes[1], &Block { header, txdata: node_txn}, nodes[1].best_block_info().1 + 1);
2806+
connect_block(&nodes[1], &Block { header, txdata: node_txn});
28072807
{
28082808
let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
28092809
assert_eq!(added_monitors.len(), 1);
@@ -2896,7 +2896,7 @@ fn test_htlc_on_chain_success() {
28962896

28972897
// Verify that A's ChannelManager is able to extract preimage from preimage tx and generate PaymentSent
28982898
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
2899-
connect_block(&nodes[0], &Block { header, txdata: vec![commitment_tx[0].clone(), node_txn[0].clone()] }, nodes[0].best_block_info().1 + 1);
2899+
connect_block(&nodes[0], &Block { header, txdata: vec![commitment_tx[0].clone(), node_txn[0].clone()] });
29002900
check_closed_broadcast!(nodes[0], false);
29012901
check_added_monitors!(nodes[0], 1);
29022902
let events = nodes[0].node.get_and_clear_pending_events();
@@ -3414,14 +3414,14 @@ fn test_htlc_ignore_latest_remote_commitment() {
34143414
assert_eq!(node_txn.len(), 2);
34153415

34163416
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
3417-
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]}, nodes[1].best_block_info().1 + 1);
3417+
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]});
34183418
check_closed_broadcast!(nodes[1], false);
34193419
check_added_monitors!(nodes[1], 1);
34203420

34213421
// Duplicate the connect_block call since this may happen due to other listeners
34223422
// registering new transactions
34233423
header.prev_blockhash = header.block_hash();
3424-
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]}, nodes[1].best_block_info().1 + 1);
3424+
connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]});
34253425
}
34263426

34273427
#[test]
@@ -4042,12 +4042,12 @@ fn do_test_htlc_timeout(send_partial_mpp: bool) {
40424042
header: BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
40434043
txdata: vec![],
40444044
};
4045-
connect_block(&nodes[0], &block, CHAN_CONFIRM_DEPTH + 1);
4046-
connect_block(&nodes[1], &block, CHAN_CONFIRM_DEPTH + 1);
4047-
for i in CHAN_CONFIRM_DEPTH + 2 ..TEST_FINAL_CLTV + CHAN_CONFIRM_DEPTH + 2 - CLTV_CLAIM_BUFFER - LATENCY_GRACE_PERIOD_BLOCKS {
4045+
connect_block(&nodes[0], &block);
4046+
connect_block(&nodes[1], &block);
4047+
for _ in CHAN_CONFIRM_DEPTH + 2 ..TEST_FINAL_CLTV + CHAN_CONFIRM_DEPTH + 2 - CLTV_CLAIM_BUFFER - LATENCY_GRACE_PERIOD_BLOCKS {
40484048
block.header.prev_blockhash = block.block_hash();
4049-
connect_block(&nodes[0], &block, i);
4050-
connect_block(&nodes[1], &block, i);
4049+
connect_block(&nodes[0], &block);
4050+
connect_block(&nodes[1], &block);
40514051
}
40524052

40534053
expect_pending_htlcs_forwardable!(nodes[1]);
@@ -4894,7 +4894,7 @@ fn test_static_spendable_outputs_justice_tx_revoked_htlc_timeout_tx() {
48944894

48954895
// B will generate justice tx from A's revoked commitment/HTLC tx
48964896
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
4897-
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_local_txn[0].clone(), revoked_htlc_txn[0].clone()] }, nodes[1].best_block_info().1 + 1);
4897+
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_local_txn[0].clone(), revoked_htlc_txn[0].clone()] });
48984898
check_closed_broadcast!(nodes[1], false);
48994899
check_added_monitors!(nodes[1], 1);
49004900

@@ -4966,7 +4966,7 @@ fn test_static_spendable_outputs_justice_tx_revoked_htlc_success_tx() {
49664966

49674967
// A will generate justice tx from B's revoked commitment/HTLC tx
49684968
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
4969-
connect_block(&nodes[0], &Block { header, txdata: vec![revoked_local_txn[0].clone(), revoked_htlc_txn[0].clone()] }, nodes[0].best_block_info().1 + 1);
4969+
connect_block(&nodes[0], &Block { header, txdata: vec![revoked_local_txn[0].clone(), revoked_htlc_txn[0].clone()] });
49704970
check_closed_broadcast!(nodes[0], false);
49714971
check_added_monitors!(nodes[0], 1);
49724972

@@ -5057,7 +5057,7 @@ fn test_onchain_to_onchain_claim() {
50575057

50585058
// So we broadcast C's commitment tx and HTLC-Success on B's chain, we should successfully be able to extract preimage and update downstream monitor
50595059
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
5060-
connect_block(&nodes[1], &Block { header, txdata: vec![c_txn[1].clone(), c_txn[2].clone()]}, nodes[1].best_block_info().1 + 1);
5060+
connect_block(&nodes[1], &Block { header, txdata: vec![c_txn[1].clone(), c_txn[2].clone()]});
50615061
{
50625062
let mut b_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
50635063
// ChannelMonitor: claim tx, ChannelManager: local commitment tx + HTLC-timeout tx
@@ -5700,8 +5700,8 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
57005700
header: BlockHeader { version: 0x20000000, prev_blockhash: starting_block.0, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
57015701
txdata: vec![],
57025702
};
5703-
for i in starting_block.1 + 1..TEST_FINAL_CLTV - CLTV_CLAIM_BUFFER + starting_block.1 + 2 {
5704-
connect_block(&nodes[1], &block, i);
5703+
for _ in starting_block.1 + 1..TEST_FINAL_CLTV - CLTV_CLAIM_BUFFER + starting_block.1 + 2 {
5704+
connect_block(&nodes[1], &block);
57055705
block.header.prev_blockhash = block.block_hash();
57065706
}
57075707
test_txn_broadcast(&nodes[1], &chan, None, if use_dust { HTLCType::NONE } else { HTLCType::SUCCESS });
@@ -5732,8 +5732,8 @@ fn do_htlc_claim_current_remote_commitment_only(use_dust: bool) {
57325732
let starting_block = nodes[1].best_block_info();
57335733
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: starting_block.0, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
57345734

5735-
for i in starting_block.1 + 1..TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + starting_block.1 + 2 {
5736-
connect_block(&nodes[0], &Block { header, txdata: Vec::new()}, i);
5735+
for _ in starting_block.1 + 1..TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + starting_block.1 + 2 {
5736+
connect_block(&nodes[0], &Block { header, txdata: Vec::new()});
57375737
header.prev_blockhash = header.block_hash();
57385738
}
57395739
test_txn_broadcast(&nodes[0], &chan, None, HTLCType::NONE);
@@ -5779,8 +5779,8 @@ fn do_htlc_claim_previous_remote_commitment_only(use_dust: bool, check_revoke_no
57795779
header: BlockHeader { version: 0x20000000, prev_blockhash: starting_block.0, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 },
57805780
txdata: vec![],
57815781
};
5782-
for i in starting_block.1 + 1..TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + CHAN_CONFIRM_DEPTH + 2 {
5783-
connect_block(&nodes[0], &block, i);
5782+
for _ in starting_block.1 + 1..TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + CHAN_CONFIRM_DEPTH + 2 {
5783+
connect_block(&nodes[0], &block);
57845784
block.header.prev_blockhash = block.block_hash();
57855785
}
57865786
if !check_revoke_no_close {
@@ -7620,13 +7620,12 @@ fn test_bump_penalty_txn_on_revoked_commitment() {
76207620
}
76217621

76227622
// Connect blocks to change height_timer range to see if we use right soonest_timelock
7623-
let starting_height = nodes[1].best_block_info().1;
76247623
let header_114 = connect_blocks(&nodes[1], 14);
76257624

76267625
// Actually revoke tx by claiming a HTLC
76277626
claim_payment(&nodes[0], &vec!(&nodes[1])[..], payment_preimage, 3_000_000);
76287627
let header = BlockHeader { version: 0x20000000, prev_blockhash: header_114, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7629-
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_txn[0].clone()] }, 15 + starting_height);
7628+
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_txn[0].clone()] });
76307629
check_added_monitors!(nodes[1], 1);
76317630

76327631
// One or more justice tx should have been broadcast, check it
@@ -7719,7 +7718,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
77197718

77207719
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
77217720
// B will generate both revoked HTLC-timeout/HTLC-preimage txn from revoked commitment tx
7722-
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_local_txn[0].clone()] }, CHAN_CONFIRM_DEPTH + 1);
7721+
connect_block(&nodes[1], &Block { header, txdata: vec![revoked_local_txn[0].clone()] });
77237722
check_closed_broadcast!(nodes[1], false);
77247723
check_added_monitors!(nodes[1], 1);
77257724

@@ -7744,9 +7743,9 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
77447743
// Broadcast set of revoked txn on A
77457744
let hash_128 = connect_blocks(&nodes[0], 40);
77467745
let header_11 = BlockHeader { version: 0x20000000, prev_blockhash: hash_128, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7747-
connect_block(&nodes[0], &Block { header: header_11, txdata: vec![revoked_local_txn[0].clone()] }, CHAN_CONFIRM_DEPTH + 40 + 1);
7746+
connect_block(&nodes[0], &Block { header: header_11, txdata: vec![revoked_local_txn[0].clone()] });
77487747
let header_129 = BlockHeader { version: 0x20000000, prev_blockhash: header_11.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7749-
connect_block(&nodes[0], &Block { header: header_129, txdata: vec![revoked_htlc_txn[0].clone(), revoked_htlc_txn[1].clone()] }, CHAN_CONFIRM_DEPTH + 40 + 2);
7748+
connect_block(&nodes[0], &Block { header: header_129, txdata: vec![revoked_htlc_txn[0].clone(), revoked_htlc_txn[1].clone()] });
77507749
expect_pending_htlcs_forwardable_ignore!(nodes[0]);
77517750
let first;
77527751
let feerate_1;
@@ -7798,9 +7797,9 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
77987797

77997798
// Connect one more block to see if bumped penalty are issued for HTLC txn
78007799
let header_130 = BlockHeader { version: 0x20000000, prev_blockhash: header_129.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7801-
connect_block(&nodes[0], &Block { header: header_130, txdata: penalty_txn }, CHAN_CONFIRM_DEPTH + 40 + 3);
7800+
connect_block(&nodes[0], &Block { header: header_130, txdata: penalty_txn });
78027801
let header_131 = BlockHeader { version: 0x20000000, prev_blockhash: header_130.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7803-
connect_block(&nodes[0], &Block { header: header_131, txdata: Vec::new() }, CHAN_CONFIRM_DEPTH + 40 + 4);
7802+
connect_block(&nodes[0], &Block { header: header_131, txdata: Vec::new() });
78047803
{
78057804
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
78067805
assert_eq!(node_txn.len(), 2); // 2 bumped penalty txn on revoked commitment tx
@@ -7839,7 +7838,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
78397838
};
78407839
// Broadcast claim txn and confirm blocks to avoid further bumps on this outputs
78417840
let header_145 = BlockHeader { version: 0x20000000, prev_blockhash: header_144, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
7842-
connect_block(&nodes[0], &Block { header: header_145, txdata: node_txn }, CHAN_CONFIRM_DEPTH + 40 + 8 + 10);
7841+
connect_block(&nodes[0], &Block { header: header_145, txdata: node_txn });
78437842
connect_blocks(&nodes[0], 20);
78447843
{
78457844
let mut node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
@@ -8039,7 +8038,7 @@ fn test_bump_txn_sanitize_tracking_maps() {
80398038
penalty_txn
80408039
};
80418040
let header_130 = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
8042-
connect_block(&nodes[0], &Block { header: header_130, txdata: penalty_txn }, nodes[0].best_block_info().1 + 1);
8041+
connect_block(&nodes[0], &Block { header: header_130, txdata: penalty_txn });
80438042
connect_blocks(&nodes[0], ANTI_REORG_DELAY - 1);
80448043
{
80458044
let monitors = nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap();
@@ -8385,7 +8384,7 @@ fn test_htlc_no_detection() {
83858384

83868385
// Timeout HTLC on A's chain and so it can generate a HTLC-Timeout tx
83878386
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
8388-
connect_block(&nodes[0], &Block { header, txdata: vec![local_txn[0].clone()] }, nodes[0].best_block_info().1 + 1);
8387+
connect_block(&nodes[0], &Block { header, txdata: vec![local_txn[0].clone()] });
83898388
// We deliberately connect the local tx twice as this should provoke a failure calling
83908389
// this test before #653 fix.
83918390
chain::Listen::block_connected(&nodes[0].chain_monitor.chain_monitor, &Block { header, txdata: vec![local_txn[0].clone()] }, nodes[0].best_block_info().1 + 1);
@@ -8401,7 +8400,7 @@ fn test_htlc_no_detection() {
84018400
};
84028401

84038402
let header_201 = BlockHeader { version: 0x20000000, prev_blockhash: header.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
8404-
connect_block(&nodes[0], &Block { header: header_201, txdata: vec![htlc_timeout.clone()] }, nodes[0].best_block_info().1 + 1);
8403+
connect_block(&nodes[0], &Block { header: header_201, txdata: vec![htlc_timeout.clone()] });
84058404
connect_blocks(&nodes[0], ANTI_REORG_DELAY - 1);
84068405
expect_payment_failed!(nodes[0], our_payment_hash, true);
84078406
}
@@ -8455,7 +8454,7 @@ fn do_test_onchain_htlc_settlement_after_close(broadcast_alice: bool, go_onchain
84558454
false => get_local_commitment_txn!(nodes[1], chan_ab.2)
84568455
};
84578456
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
8458-
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]}, CHAN_CONFIRM_DEPTH * 2 + 1);
8457+
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]});
84598458
let mut bob_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
84608459
if broadcast_alice {
84618460
check_closed_broadcast!(nodes[1], false);
@@ -8534,7 +8533,7 @@ fn do_test_onchain_htlc_settlement_after_close(broadcast_alice: bool, go_onchain
85348533
if !broadcast_alice { txn_to_broadcast = get_local_commitment_txn!(nodes[1], chan_ab.2); }
85358534
if !go_onchain_before_fulfill {
85368535
let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
8537-
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]}, CHAN_CONFIRM_DEPTH * 2 + 1);
8536+
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]});
85388537
// If Bob was the one to force-close, he will have already passed these checks earlier.
85398538
if broadcast_alice {
85408539
check_closed_broadcast!(nodes[1], false);

0 commit comments

Comments
 (0)