Skip to content

fuzz: add force-close support to chanmon_consistency#4381

Draft
joostjager wants to merge 3 commits intolightningdevkit:mainfrom
joostjager:fuzz-force-close
Draft

fuzz: add force-close support to chanmon_consistency#4381
joostjager wants to merge 3 commits intolightningdevkit:mainfrom
joostjager:fuzz-force-close

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Feb 4, 2026

Add force-close fuzzing support to chanmon_consistency. Two new actions (0xc0, 0xc1) allow force-closing one channel on each peer pair (A-B and B-C), testing channel monitor consistency when channels are intentionally closed.

🚧 Work in progress - More checks need to be added to verify channel state consistency after force-close, particularly around monitor update handling and interaction with pending HTLCs.

Based on #4367

joostjager and others added 3 commits February 3, 2026 16:18
This expands the channel monitor consistency fuzz test from 2 channels
to 6 channels (3 between A-B and 3 between B-C), enabling future MPP
payment testing.

Changes:
- Extract `connect_peers!` macro from `make_channel!` to avoid duplicate
  peer connections
- Create channel arrays `chan_ab_ids[3]` and `chan_bc_ids[3]`
- Store SCIDs in `chan_ab_scids[3]` and `chan_bc_scids[3]`
- Use funding transaction versions 1-6 to avoid txid collisions under
  fuzz hashing (which XORs all bytes to a single byte, causing versions
  0-5 to collide between A-B and B-C channel pairs)
- Update `test_return!` assertions to expect 3/6/3 channels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add multi-path payment (MPP) fuzzing commands that split payments across
multiple channels:

- send_mpp_payment: direct MPP from source to dest using multiple channels
- send_mpp_hop_payment: MPP via intermediate node with multiple channels
  on either or both hops

New fuzz commands:
- 0x70: direct MPP 0->1 (uses all 3 A-B channels)
- 0x71: MPP 0->1->2, multi channels on first hop (A-B)
- 0x72: MPP 0->1->2, multi channels on both hops (A-B and B-C)
- 0x73: MPP 0->1->2, multi channels on second hop (B-C)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add two new fuzzer actions (0xc0, 0xc1) to force-close one channel
on each peer pair (A-B and B-C). This tests channel monitor
consistency when channels are intentionally closed.

Changes:
- Add fc_ab/fc_bc bools to track force-closed channels
- Handle HandleError, BroadcastChannelUpdate, and ChannelClosed
  events generated by force-close
- Update test_return! macro to account for closed channels
- Skip force-closed channels in 0xff validation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@joostjager joostjager self-assigned this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants