Skip to content

add: added basic structure of forward failure reasons - #9419

Draft
Andezion wants to merge 1 commit into
ElementsProject:masterfrom
Andezion:forward-failure-reason
Draft

add: added basic structure of forward failure reasons#9419
Andezion wants to merge 1 commit into
ElementsProject:masterfrom
Andezion:forward-failure-reason

Conversation

@Andezion

Copy link
Copy Markdown
Collaborator

Changelog-None

Important

26.09 FREEZE August 5th: Non-bugfix PRs not ready by this date will wait for 26.12.

RC1 is scheduled on August 17th

The final release is scheduled for September 7th.

Summary

Classify locally-failed forwards with a precise root cause (failure_reason)

forward_event/listforwards currently only expose the raw BOLT4 onion failcode for local_failed forwards, WIRE_TEMPORARY_CHANNEL_FAILURE - which is the same code for at least three unrelated causes (insufficient outgoing liquidity, too many HTLCs, dust limit, peer offline...). Operators can't tell "we're out of outgoing liquidity" from other failure classes

This adds a new optional failure_reason string field (insufficient_outgoing_liquidity, outgoing_peer_offline, cltv_expiry_too_far, ...) derived as close to the real root cause as possible - including carrying the precise cause out of channeld's channel_add_htlc result instead of discarding it, and fixing a gap where a forward that failed because the outgoing subdaemon died mid-send never appeared in listforwards at all

Purely additive - existing failcode/failreason fields and old DB rows are untouched. Includes a new pytest reproducing the insufficient-liquidity case end-to-end and doc/schema updates.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • [ x] The changelog has been updated in the relevant commit(s) according to the guidelines.
  • [ x] Tests have been added or modified to reflect the changes.
  • [ x] Documentation has been reviewed and updated as needed.
  • [ x] Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

@Andezion Andezion self-assigned this Aug 14, 2026
@Andezion
Andezion force-pushed the forward-failure-reason branch from 8e3085c to fb03867 Compare August 14, 2026 09:10
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.

1 participant