Skip to content

Commit c895821

Browse files
jkczyzclaude
andcommitted
Accept splice and RBF warning disconnects in chanmon_consistency
The HandleError assertion only accepted "timeout awaiting response" warnings. However, the fuzzer can deliver messages in unusual orders that trigger legitimate splice and RBF validation failures (e.g., attempting RBF after splice_locked, splicing before quiescence, or splicing a channel that is not live). These produce DisconnectPeerWithWarning with different messages that the assertion needs to accept. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c972bf2 commit c895821

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -894,18 +894,25 @@ fn send_mpp_hop_payment(
894894
}
895895

896896
#[inline]
897-
fn assert_action_timeout_awaiting_response(action: &msgs::ErrorAction) {
898-
// Since sending/receiving messages may be delayed, `timer_tick_occurred` may cause a node to
899-
// disconnect their counterparty if they're expecting a timely response.
900-
assert!(
901-
matches!(
902-
action,
903-
msgs::ErrorAction::DisconnectPeerWithWarning { msg }
897+
fn assert_action_disconnect_with_warning(action: &msgs::ErrorAction) {
898+
match action {
899+
msgs::ErrorAction::DisconnectPeerWithWarning { msg }
904900
if msg.data.contains("Disconnecting due to timeout awaiting response")
905-
),
906-
"Expected timeout disconnect, got: {:?}",
907-
action,
908-
);
901+
|| msg.data.contains("cannot RBF")
902+
|| msg.data.contains("before RBF")
903+
|| msg.data.contains("needed for RBF")
904+
|| msg.data.contains("splice to RBF")
905+
|| msg.data.contains("candidates to RBF")
906+
|| msg.data.contains("candidates for RBF")
907+
|| msg.data.contains("before spliced")
908+
|| msg.data.contains("needed to splice")
909+
|| msg.data.contains("a splice pending")
910+
|| msg.data.contains("cannot be spliced")
911+
|| msg.data.contains("Splicing requested on a channel that is not live")
912+
|| msg.data.contains("funding negotiation already in progress") =>
913+
{},
914+
_ => panic!("Unexpected error action: {:?}", action),
915+
}
909916
}
910917

911918
enum ChanType {
@@ -1658,7 +1665,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
16581665
*node_id == a_id
16591666
},
16601667
MessageSendEvent::HandleError { ref action, ref node_id } => {
1661-
assert_action_timeout_awaiting_response(action);
1668+
assert_action_disconnect_with_warning(action);
16621669
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
16631670
*node_id == a_id
16641671
},
@@ -1888,7 +1895,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
18881895
}
18891896
},
18901897
MessageSendEvent::HandleError { ref action, .. } => {
1891-
assert_action_timeout_awaiting_response(action);
1898+
assert_action_disconnect_with_warning(action);
18921899
},
18931900
MessageSendEvent::SendChannelReady { .. } => {
18941901
// Can be generated as a reestablish response
@@ -1941,7 +1948,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
19411948
MessageSendEvent::SendAnnouncementSignatures { .. } => {},
19421949
MessageSendEvent::SendChannelUpdate { .. } => {},
19431950
MessageSendEvent::HandleError { ref action, .. } => {
1944-
assert_action_timeout_awaiting_response(action);
1951+
assert_action_disconnect_with_warning(action);
19451952
},
19461953
_ => panic!("Unhandled message event"),
19471954
}
@@ -1963,7 +1970,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
19631970
MessageSendEvent::SendAnnouncementSignatures { .. } => {},
19641971
MessageSendEvent::SendChannelUpdate { .. } => {},
19651972
MessageSendEvent::HandleError { ref action, .. } => {
1966-
assert_action_timeout_awaiting_response(action);
1973+
assert_action_disconnect_with_warning(action);
19671974
},
19681975
_ => panic!("Unhandled message event"),
19691976
}

0 commit comments

Comments
 (0)