Skip to content

Commit 217bf92

Browse files
jkczyzclaude
andcommitted
Update expect_splice_failed_events to assert on channel_id
Change the expect_splice_failed_events helper to take expected_channel_id instead of expected_counterparty_node_id, providing more specific assertions and consistency with expect_discard_funding_event. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a6bd537 commit 217bf92

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,14 +3203,14 @@ pub fn expect_splice_pending_event<'a, 'b, 'c, 'd>(
32033203

32043204
#[cfg(any(test, ldk_bench, feature = "_test_utils"))]
32053205
pub fn expect_splice_failed_events<'a, 'b, 'c, 'd>(
3206-
node: &'a Node<'b, 'c, 'd>, expected_counterparty_node_id: &PublicKey,
3206+
node: &'a Node<'b, 'c, 'd>, expected_channel_id: &ChannelId,
32073207
funding_contribution: FundingContribution,
32083208
) {
32093209
let events = node.node.get_and_clear_pending_events();
32103210
assert_eq!(events.len(), 2);
32113211
match &events[0] {
3212-
Event::SpliceFailed { channel_id: _, counterparty_node_id, .. } => {
3213-
assert_eq!(*expected_counterparty_node_id, *counterparty_node_id);
3212+
Event::SpliceFailed { channel_id, .. } => {
3213+
assert_eq!(*expected_channel_id, *channel_id);
32143214
},
32153215
_ => panic!("Unexpected event"),
32163216
}

lightning/src/ln/splicing_tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ fn do_test_splice_state_reset_on_disconnect(reload: bool) {
562562
nodes[1].node.peer_disconnected(node_id_0);
563563
}
564564

565-
expect_splice_failed_events(&nodes[0], &node_id_1, funding_contribution);
565+
expect_splice_failed_events(&nodes[0], &channel_id, funding_contribution);
566566

567567
let mut reconnect_args = ReconnectArgs::new(&nodes[0], &nodes[1]);
568568
reconnect_args.send_channel_ready = (true, true);
@@ -613,7 +613,7 @@ fn do_test_splice_state_reset_on_disconnect(reload: bool) {
613613
nodes[1].node.peer_disconnected(node_id_0);
614614
}
615615

616-
expect_splice_failed_events(&nodes[0], &node_id_1, funding_contribution);
616+
expect_splice_failed_events(&nodes[0], &channel_id, funding_contribution);
617617

618618
let mut reconnect_args = ReconnectArgs::new(&nodes[0], &nodes[1]);
619619
reconnect_args.send_channel_ready = (true, true);
@@ -695,7 +695,7 @@ fn do_test_splice_state_reset_on_disconnect(reload: bool) {
695695

696696
let tx_abort = get_event_msg!(nodes[0], MessageSendEvent::SendTxAbort, node_id_1);
697697
nodes[1].node.handle_tx_abort(node_id_0, &tx_abort);
698-
expect_splice_failed_events(&nodes[0], &node_id_1, funding_contribution);
698+
expect_splice_failed_events(&nodes[0], &channel_id, funding_contribution);
699699

700700
// Attempt a splice negotiation that completes, (i.e. `tx_signatures` are exchanged). Reconnecting
701701
// should not abort the negotiation or reset the splice state.
@@ -777,7 +777,7 @@ fn test_config_reject_inbound_splices() {
777777
nodes[0].node.peer_disconnected(node_id_1);
778778
nodes[1].node.peer_disconnected(node_id_0);
779779

780-
expect_splice_failed_events(&nodes[0], &node_id_1, funding_contribution);
780+
expect_splice_failed_events(&nodes[0], &channel_id, funding_contribution);
781781

782782
let mut reconnect_args = ReconnectArgs::new(&nodes[0], &nodes[1]);
783783
reconnect_args.send_channel_ready = (true, true);
@@ -1966,7 +1966,7 @@ fn fail_splice_on_interactive_tx_error() {
19661966
get_event_msg!(acceptor, MessageSendEvent::SendTxComplete, node_id_initiator);
19671967
initiator.node.handle_tx_add_input(node_id_acceptor, &tx_add_input);
19681968

1969-
expect_splice_failed_events(initiator, &node_id_acceptor, funding_contribution);
1969+
expect_splice_failed_events(initiator, &channel_id, funding_contribution);
19701970

19711971
let tx_abort = get_event_msg!(initiator, MessageSendEvent::SendTxAbort, node_id_acceptor);
19721972
acceptor.node.handle_tx_abort(node_id_initiator, &tx_abort);
@@ -2015,7 +2015,7 @@ fn fail_splice_on_tx_abort() {
20152015
let tx_abort = get_event_msg!(acceptor, MessageSendEvent::SendTxAbort, node_id_initiator);
20162016
initiator.node.handle_tx_abort(node_id_acceptor, &tx_abort);
20172017

2018-
expect_splice_failed_events(initiator, &node_id_acceptor, funding_contribution);
2018+
expect_splice_failed_events(initiator, &channel_id, funding_contribution);
20192019

20202020
let tx_abort = get_event_msg!(initiator, MessageSendEvent::SendTxAbort, node_id_acceptor);
20212021
acceptor.node.handle_tx_abort(node_id_initiator, &tx_abort);
@@ -2828,7 +2828,7 @@ fn test_funding_contributed_channel_shutdown() {
28282828
})
28292829
);
28302830

2831-
expect_splice_failed_events(&nodes[0], &node_id_1, funding_contribution);
2831+
expect_splice_failed_events(&nodes[0], &channel_id, funding_contribution);
28322832
}
28332833

28342834
#[test]

0 commit comments

Comments
 (0)