Use handle_and_accept_open_channel in async_signer test
What changed, and why it matters
This commit is a minor cleanup of an internal test file. It replaces a small block of test code with an existing helper function when testing the non-zero-conf path. There is no change to production code, no security fix, and no user-facing behavior change.
No action required; this is a test-only refactor with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to lightning/src/ln/async_signer_tests.rs. In the do_test_open_channel test, the non-zero-conf branch previously manually called handle_open_channel, drained pending events, matched OpenChannelRequest, and called accept_inbound_channel. The patch moves handle_open_channel into the zero-conf branch only and uses the existing handle_and_accept_open_channel helper for the non-zero-conf branch. This is purely test refactoring.
Changed components
lightning/src/ln/async_signer_tests.rsInspect captured patch +2 / −10
diff --git a/lightning/src/ln/async_signer_tests.rs b/lightning/src/ln/async_signer_tests.rs
index 04bca52..b81279c 100644
--- a/lightning/src/ln/async_signer_tests.rs
+++ b/lightning/src/ln/async_signer_tests.rs
@@ -70,9 +70,9 @@ fn do_test_open_channel(zero_conf: bool) {
// Handle an inbound channel simulating an async signer.
nodes[1].disable_next_channel_signer_op(SignerOp::GetPerCommitmentPoint);
- nodes[1].node.handle_open_channel(node_a_id, &open_chan_msg);
if zero_conf {
+ nodes[1].node.handle_open_channel(node_a_id, &open_chan_msg);
let events = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1, "Expected one event, got {}", events.len());
match &events[0] {
@@ -90,15 +90,7 @@ fn do_test_open_channel(zero_conf: bool) {
ev => panic!("Expected OpenChannelRequest, not {:?}", ev),
}
} else {
- let events = nodes[1].node.get_and_clear_pending_events();
- assert_eq!(events.len(), 1, "Expected one event, got {}", events.len());
- match &events[0] {
- Event::OpenChannelRequest { temporary_channel_id, .. } => nodes[1]
- .node
- .accept_inbound_channel(temporary_channel_id, &node_a_id, 0, None)
- .unwrap(),
- ev => panic!("Expected OpenChannelRequest, not {:?}", ev),
- }
+ handle_and_accept_open_channel(&nodes[1], node_a_id, &open_chan_msg);
}
let channel_id_1 = {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.