Skip to content

Add HTLC forward counters for client channel monitoring#17

Merged
amackillop merged 1 commit intolsp-0.7.0from
austin_mdk-699_forward-metrics
Apr 1, 2026
Merged

Add HTLC forward counters for client channel monitoring#17
amackillop merged 1 commit intolsp-0.7.0from
austin_mdk-699_forward-metrics

Conversation

@amackillop
Copy link
Copy Markdown

Count success/failure for HTLC forwards that touch private (client) channels. Public-to-public forwards are ignored.

Counters are plain AtomicU64s so ldk-node doesn't pull in prometheus. The app layer reads snapshots via Node::forward_counters() and maps them to whatever it wants.

Each forward is classified by direction (to_client vs from_client) and outcome (success, downstream failure, local failure). A separate counter tracks UnknownNextHop/InvalidForward hits, which point at SCID alias tracking bugs.

Channel lookup uses is_announced on both sides. If a channel is gone by the time the event fires, we assume private. Safe default for an LSP.

Count success/failure for HTLC forwards that touch private (client)
channels. Public-to-public forwards are ignored.

Counters are plain AtomicU64s so ldk-node doesn't pull in prometheus.
The app layer reads snapshots via Node::forward_counters() and maps
them to whatever it wants.

Each forward is classified by direction (to_client vs from_client)
and outcome (success, downstream failure, local failure). A separate
counter tracks UnknownNextHop/InvalidForward hits, which point at
SCID alias tracking bugs.

Channel lookup uses is_announced on both sides. If a channel is gone
by the time the event fires, we assume private. Safe default for
an LSP.
Copy link
Copy Markdown

@martinsaposnic martinsaposnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed with the help of claude,

 ┌──────────┬───────┬─────────────────────────────────────────────────────────────────────────────────────────┐
  │ Severity │ Count │                                          Items                                          │
  ├──────────┼───────┼─────────────────────────────────────────────────────────────────────────────────────────┤
  │ Major    │ 1     │ Clone on HTLCHandlingFailureType needs verification                                     │
  ├──────────┼───────┼─────────────────────────────────────────────────────────────────────────────────────────┤
  │ Minor    │ 3     │ channels scope widened, unknown-channel default silent, ForwardSnapshot not re-exported │
  ├──────────┼───────┼─────────────────────────────────────────────────────────────────────────────────────────┤
  │ Nit      │ 2     │ Relaxed ordering (fine), boolean trap in record_failure                                 │
  └──────────┴───────┴─────────────────────────────────────────────────────────────────────────────────────────┘

about the "major" item, did cargo check locally and it works. minor issues and nits are safe to ignore

@amackillop amackillop merged commit 735bb99 into lsp-0.7.0 Apr 1, 2026
6 of 34 checks passed
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