Skip to content

Commit 3716227

Browse files
committed
Fix three_hop_blinded_path_success with different randomization
In `three_hop_blinded_path_success`, the nodes in the test ended up at radically different block heights after channel opening. At that point, if the CLTV randomization is done slightly different the test payment may fail, which we fix here by ensuring all nodes are at the same height before we go to send a payment.
1 parent a5ba339 commit 3716227

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,12 @@ fn three_hop_blinded_path_success() {
509509
let chan_upd_2_3 = create_announced_chan_between_nodes_with_value(&nodes, 2, 3, 1_000_000, 0).0.contents;
510510
let chan_upd_3_4 = create_announced_chan_between_nodes_with_value(&nodes, 3, 4, 1_000_000, 0).0.contents;
511511

512+
// Get all our nodes onto the same height so payments don't fail for CLTV violations.
513+
connect_blocks(&nodes[0], nodes[4].best_block_info().1 - nodes[0].best_block_info().1);
514+
connect_blocks(&nodes[1], nodes[4].best_block_info().1 - nodes[1].best_block_info().1);
515+
connect_blocks(&nodes[2], nodes[4].best_block_info().1 - nodes[2].best_block_info().1);
516+
assert_eq!(nodes[4].best_block_info().1, nodes[3].best_block_info().1);
517+
512518
let amt_msat = 5000;
513519
let (payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash(&nodes[4], Some(amt_msat), None);
514520
let route_params = get_blinded_route_parameters(amt_msat, payment_secret,

0 commit comments

Comments
 (0)