Skip to content

Commit b015492

Browse files
committed
Add chanmon stuck HTLC invariant
Assert that channel HTLC sets are empty after harness quiescence.
1 parent 75ac90a commit b015492

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,24 @@ 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()
2734+
&& chan.pending_outbound_htlcs.is_empty(),
2735+
"Node {} channel {:?} has stuck HTLCs after settling all state: \
2736+
{} inbound {:?}, {} outbound {:?}",
2737+
idx,
2738+
chan.channel_id,
2739+
chan.pending_inbound_htlcs.len(),
2740+
chan.pending_inbound_htlcs,
2741+
chan.pending_outbound_htlcs.len(),
2742+
chan.pending_outbound_htlcs
2743+
);
2744+
}
2745+
}
2746+
27292747
// Finally, make sure that at least one end of each channel can make a substantial payment.
27302748
let chan_ab_ids = self.ab_link.channel_ids().clone();
27312749
let chan_bc_ids = self.bc_link.channel_ids().clone();

0 commit comments

Comments
 (0)