Add HTLC forward counters for client channel monitoring#17
Merged
amackillop merged 1 commit intolsp-0.7.0from Apr 1, 2026
Merged
Add HTLC forward counters for client channel monitoring#17amackillop merged 1 commit intolsp-0.7.0from
amackillop merged 1 commit intolsp-0.7.0from
Conversation
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.
martinsaposnic
approved these changes
Apr 1, 2026
martinsaposnic
left a comment
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.