Skip to content

Commit 8d15e4e

Browse files
committed
Feat: Make random bytes deterministic within the test test_restored_packages_retry fixes lightningdevkit#2827
1 parent fbeb7ac commit 8d15e4e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/src/ln/monitor_tests.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1977,12 +1977,17 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool
19771977
let node_deserialized;
19781978

19791979
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
1980-
1980+
19811981
// Open a channel, lock in an HTLC, and immediately broadcast the commitment transaction. This
19821982
// ensures that the HTLC timeout package is held until we reach its expiration height.
19831983
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100_000, 50_000_000);
19841984
route_payment(&nodes[0], &[&nodes[1]], 10_000_000);
19851985

1986+
// Force duplicate randomness for every get-random call
1987+
for node in nodes.iter() {
1988+
*node.keys_manager.override_random_bytes.lock().unwrap() = Some([0; 32]);
1989+
}
1990+
19861991
nodes[0].node.force_close_broadcasting_latest_txn(&chan_id, &nodes[1].node.get_our_node_id()).unwrap();
19871992
check_added_monitors(&nodes[0], 1);
19881993
check_closed_broadcast(&nodes[0], 1, true);

0 commit comments

Comments
 (0)