Skip to content

Commit e438602

Browse files
committed
f tests that depend on block count consts
1 parent 6200f76 commit e438602

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lightning/src/ln/async_payments_tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,13 @@ fn async_receive_mpp() {
537537
create_announced_chan_between_nodes(&nodes, 0, 2);
538538
create_unannounced_chan_between_nodes_with_value(&nodes, 1, 3, 1_000_000, 0);
539539
create_unannounced_chan_between_nodes_with_value(&nodes, 2, 3, 1_000_000, 0);
540+
541+
// Ensure all nodes start at the same height.
542+
connect_blocks(&nodes[0], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[0].best_block_info().1);
543+
connect_blocks(&nodes[1], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[1].best_block_info().1);
544+
connect_blocks(&nodes[2], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[2].best_block_info().1);
545+
connect_blocks(&nodes[3], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[3].best_block_info().1);
546+
540547
let (offer, static_invoice) = create_static_invoice(&nodes[1], &nodes[3], None, &secp_ctx);
541548

542549
// In other tests we hardcode the sender's random bytes so we can predict the keysend preimage to
@@ -618,6 +625,12 @@ fn amount_doesnt_match_invreq() {
618625
create_unannounced_chan_between_nodes_with_value(&nodes, 1, 3, 1_000_000, 0);
619626
create_unannounced_chan_between_nodes_with_value(&nodes, 2, 3, 1_000_000, 0);
620627

628+
// Ensure all nodes start at the same height.
629+
connect_blocks(&nodes[0], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[0].best_block_info().1);
630+
connect_blocks(&nodes[1], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[1].best_block_info().1);
631+
connect_blocks(&nodes[2], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[2].best_block_info().1);
632+
connect_blocks(&nodes[3], 4*CHAN_CONFIRM_DEPTH + 1 - nodes[3].best_block_info().1);
633+
621634
let (offer, static_invoice) = create_static_invoice(&nodes[1], &nodes[3], None, &secp_ctx);
622635

623636
// Set the random bytes so we can predict the payment preimage and hash.
@@ -810,9 +823,15 @@ fn invalid_async_receive_with_retry<F1, F2>(
810823
let node_chanmgrs =
811824
create_node_chanmgrs(3, &node_cfgs, &[None, Some(allow_priv_chan_fwds_cfg), None]);
812825
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
826+
813827
create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0);
814828
create_unannounced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0);
815829

830+
// Ensure all nodes start at the same height.
831+
connect_blocks(&nodes[0], 2*CHAN_CONFIRM_DEPTH + 1 - nodes[0].best_block_info().1);
832+
connect_blocks(&nodes[1], 2*CHAN_CONFIRM_DEPTH + 1 - nodes[1].best_block_info().1);
833+
connect_blocks(&nodes[2], 2*CHAN_CONFIRM_DEPTH + 1 - nodes[2].best_block_info().1);
834+
816835
let blinded_paths_to_always_online_node = nodes[1]
817836
.message_router
818837
.create_blinded_paths(

0 commit comments

Comments
 (0)