From 86a7287a45d4fbaf0d8179f00c44400fc44c0a92 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 7 May 2026 11:03:47 +0200 Subject: [PATCH] Add chanmon stuck HTLC invariant Assert that channel HTLC sets are empty after harness quiescence. --- fuzz/src/chanmon_consistency.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index d678d97918f..532aae2cad3 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -2939,6 +2939,24 @@ pub fn do_test(data: &[u8], out: Out) { ); } + // All HTLCs should have been claimed or failed once we reach quiescence. + for (idx, node) in nodes.iter().enumerate() { + for chan in node.list_channels() { + assert!( + chan.pending_inbound_htlcs.is_empty() + && chan.pending_outbound_htlcs.is_empty(), + "Node {} channel {:?} has stuck HTLCs after settling all state: \ + {} inbound {:?}, {} outbound {:?}", + idx, + chan.channel_id, + chan.pending_inbound_htlcs.len(), + chan.pending_inbound_htlcs, + chan.pending_outbound_htlcs.len(), + chan.pending_outbound_htlcs + ); + } + } + // Finally, make sure that at least one end of each channel can make a substantial payment for &chan_id in &chan_ab_ids { assert!(