Skip to content

Commit

Permalink
Feat: Make random bytes deterministic within the test `test_restored_…
Browse files Browse the repository at this point in the history
…packages_retry` fixes lightningdevkit#2827
  • Loading branch information
Harsh1s committed Jan 17, 2024
1 parent fbeb7ac commit 8d15e4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lightning/src/ln/monitor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1977,12 +1977,17 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool
let node_deserialized;

let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);

// Open a channel, lock in an HTLC, and immediately broadcast the commitment transaction. This
// ensures that the HTLC timeout package is held until we reach its expiration height.
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100_000, 50_000_000);
route_payment(&nodes[0], &[&nodes[1]], 10_000_000);

// Force duplicate randomness for every get-random call
for node in nodes.iter() {
*node.keys_manager.override_random_bytes.lock().unwrap() = Some([0; 32]);
}

nodes[0].node.force_close_broadcasting_latest_txn(&chan_id, &nodes[1].node.get_our_node_id()).unwrap();
check_added_monitors(&nodes[0], 1);
check_closed_broadcast(&nodes[0], 1, true);
Expand Down

0 comments on commit 8d15e4e

Please sign in to comment.