Skip to content

Commit 90980cc

Browse files
joostjagerAtishyy27
authored andcommitted
fuzz: handle missing SendTx* message events in chanmon_consistency
Add handlers for SendTxInitRbf, SendTxAckRbf, SendTxRemoveInput, and SendTxRemoveOutput in the chanmon_consistency fuzz target. These variants were reachable but not matched, causing panics on the wildcard arm ("Unhandled message event"). SendTxInitRbf became reachable after commit 5873660 added splicing support without updating the fuzz target's message delivery logic. AI tools were used in preparing this commit.
1 parent db4cf4f commit 90980cc

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,14 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
15291529
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
15301530
*node_id == a_id
15311531
},
1532+
MessageSendEvent::SendTxRemoveInput { ref node_id, .. } => {
1533+
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
1534+
*node_id == a_id
1535+
},
1536+
MessageSendEvent::SendTxRemoveOutput { ref node_id, .. } => {
1537+
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
1538+
*node_id == a_id
1539+
},
15321540
MessageSendEvent::SendTxComplete { ref node_id, .. } => {
15331541
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
15341542
*node_id == a_id
@@ -1537,6 +1545,14 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
15371545
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
15381546
*node_id == a_id
15391547
},
1548+
MessageSendEvent::SendTxInitRbf { ref node_id, .. } => {
1549+
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
1550+
*node_id == a_id
1551+
},
1552+
MessageSendEvent::SendTxAckRbf { ref node_id, .. } => {
1553+
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
1554+
*node_id == a_id
1555+
},
15401556
MessageSendEvent::SendTxSignatures { ref node_id, .. } => {
15411557
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
15421558
*node_id == a_id
@@ -1729,6 +1745,22 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
17291745
}
17301746
}
17311747
},
1748+
MessageSendEvent::SendTxInitRbf { ref node_id, ref msg } => {
1749+
for (idx, dest) in nodes.iter().enumerate() {
1750+
if dest.get_our_node_id() == *node_id {
1751+
out.locked_write(format!("Delivering tx_init_rbf from node {} to node {}.\n", $node, idx).as_bytes());
1752+
dest.handle_tx_init_rbf(nodes[$node].get_our_node_id(), msg);
1753+
}
1754+
}
1755+
},
1756+
MessageSendEvent::SendTxAckRbf { ref node_id, ref msg } => {
1757+
for (idx, dest) in nodes.iter().enumerate() {
1758+
if dest.get_our_node_id() == *node_id {
1759+
out.locked_write(format!("Delivering tx_ack_rbf from node {} to node {}.\n", $node, idx).as_bytes());
1760+
dest.handle_tx_ack_rbf(nodes[$node].get_our_node_id(), msg);
1761+
}
1762+
}
1763+
},
17321764
MessageSendEvent::SendTxSignatures { ref node_id, ref msg } => {
17331765
for (idx, dest) in nodes.iter().enumerate() {
17341766
if dest.get_our_node_id() == *node_id {

0 commit comments

Comments
 (0)