Skip to content

Commit 633c959

Browse files
joostjagerclaude
andcommitted
chanmon_consistency: tolerate drained splice tx in SplicePending handler
During settlement, the drain loop removes all transactions from broadcasters unconditionally, but confirm_tx may reject a splice transaction if its inputs are already spent. When a SplicePending event then fires, the tx is neither in the broadcaster nor in confirmed_txids, causing a panic. Replace the .expect() with an if-let to gracefully skip splice transactions that were already drained. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 720bce6 commit 633c959

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,12 +2043,16 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(
20432043
_ => &broadcast_c,
20442044
};
20452045
let mut txs = broadcaster.txn_broadcasted.borrow_mut();
2046-
let pos = txs
2046+
if let Some(pos) = txs
20472047
.iter()
20482048
.position(|tx| new_funding_txo.txid == tx.compute_txid())
2049-
.expect("SplicePending but splice tx not found in broadcaster");
2050-
let splice_tx = txs.remove(pos);
2051-
chain_state.confirm_tx(splice_tx);
2049+
{
2050+
let splice_tx = txs.remove(pos);
2051+
chain_state.confirm_tx(splice_tx);
2052+
}
2053+
// If not found, the settlement drain loop already
2054+
// removed it from the broadcaster but confirm_tx
2055+
// rejected it (e.g. inputs already spent).
20522056
}
20532057
},
20542058
events::Event::SpliceFailed { .. } => {},

0 commit comments

Comments
 (0)