Skip to content

Commit f0edabb

Browse files
committed
Add chanmon stuck HTLC invariant
Assert that channel HTLC sets are empty after harness quiescence.
1 parent 5e8c2fc commit f0edabb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,23 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
27262726
// PaymentSent event at the sender.
27272727
self.payments.assert_claims_reported();
27282728

2729+
// All HTLCs should have been claimed or failed once we reach quiescence.
2730+
for (idx, node) in self.nodes.iter().enumerate() {
2731+
for chan in node.list_channels() {
2732+
assert!(
2733+
chan.pending_inbound_htlcs.is_empty() && chan.pending_outbound_htlcs.is_empty(),
2734+
"Node {} channel {:?} has stuck HTLCs after settling all state: \
2735+
{} inbound {:?}, {} outbound {:?}",
2736+
idx,
2737+
chan.channel_id,
2738+
chan.pending_inbound_htlcs.len(),
2739+
chan.pending_inbound_htlcs,
2740+
chan.pending_outbound_htlcs.len(),
2741+
chan.pending_outbound_htlcs
2742+
);
2743+
}
2744+
}
2745+
27292746
// Finally, make sure that at least one end of each channel can make a substantial payment.
27302747
let chan_ab_ids = self.ab_link.channel_ids().clone();
27312748
let chan_bc_ids = self.bc_link.channel_ids().clone();

0 commit comments

Comments
 (0)