Skip to content

Coalesce duplicate CCH LND invoice trackers#1556

Open
jjyr wants to merge 3 commits into
nervosnetwork:developfrom
jjyr:codex/sec-0319-cch-bounds
Open

Coalesce duplicate CCH LND invoice trackers#1556
jjyr wants to merge 3 commits into
nervosnetwork:developfrom
jjyr:codex/sec-0319-cch-bounds

Conversation

@jjyr

@jjyr jjyr commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • track invoice hashes that are queued or actively monitored by the CCH LND tracker
  • coalesce repeated tracking requests for the same invoice
  • retry failed trackers only while the invoice is still tracked
  • prevent stopped trackers from being requeued after a late failure notification

Motivation

Repeated TrackInvoice messages could enqueue or start multiple LND tracker tasks for the same payment hash. The duplicate work consumed bounded tracker slots and could grow the waiting queue without adding coverage. Keeping a set of queued and active invoice hashes makes tracking idempotent while preserving retries for genuine tracker failures.

Validation

  • cargo fmt --all -- --check
  • cargo nextest run -p fnn --features sqlite -E 'test(/test_(duplicate_tracking_requests_are_coalesced|stopped_tracker_is_not_requeued_after_failure)/)'
  • cargo clippy --all-targets --features sqlite -p fnn -- -D warnings

@jjyr
jjyr marked this pull request as ready for review July 15, 2026 05:03
@gpBlockchain

Copy link
Copy Markdown
Contributor

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants