From 8d15e4ef687c67af3f44023881d5ad76ac71e830 Mon Sep 17 00:00:00 2001 From: Harsh1s Date: Thu, 18 Jan 2024 05:02:37 +0530 Subject: [PATCH 1/3] Feat: Make random bytes deterministic within the test `test_restored_packages_retry` fixes #2827 --- lightning/src/ln/monitor_tests.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs index 74740a6f227..b572ea1a484 100644 --- a/lightning/src/ln/monitor_tests.rs +++ b/lightning/src/ln/monitor_tests.rs @@ -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); From 547673c54557bdf18c30ebd6eb2ed6789c0fe66a Mon Sep 17 00:00:00 2001 From: Harsh Raj <53043454+Harsh1s@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:42:18 +0530 Subject: [PATCH 2/3] Feat: Make random bytes deterministic within the test test_restored_packages_retry fixes #2827 --- lightning/src/ln/monitor_tests.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs index 5510a626024..7c9d3861375 100644 --- a/lightning/src/ln/monitor_tests.rs +++ b/lightning/src/ln/monitor_tests.rs @@ -1982,12 +1982,10 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool // 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); From 600f3a0a035986ecc7ee541a88491d25b49f2083 Mon Sep 17 00:00:00 2001 From: Harsh Raj <53043454+Harsh1s@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:46:41 +0530 Subject: [PATCH 3/3] Feat: Make random bytes deterministic within the test test_restored_packages_retry fixes #2827 --- lightning/src/ln/monitor_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs index 7c9d3861375..b46b3f49231 100644 --- a/lightning/src/ln/monitor_tests.rs +++ b/lightning/src/ln/monitor_tests.rs @@ -1977,7 +1977,7 @@ 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);