Skip to content

lndclient: add FailureMessage and FailureCode to InterceptedHtlcResponse#267

Open
calvinrzachman wants to merge 1 commit intolightninglabs:lnd-21-0from
calvinrzachman:htlc-interception
Open

lndclient: add FailureMessage and FailureCode to InterceptedHtlcResponse#267
calvinrzachman wants to merge 1 commit intolightninglabs:lnd-21-0from
calvinrzachman:htlc-interception

Conversation

@calvinrzachman
Copy link
Contributor

Description

The routerrpc HTLC interception API in lnd already supports failure_message and failure_code on ForwardHtlcInterceptResponse, but lndclient never exposed them. This PR brings the library in line with the proto by adding FailureMessage and FailureCode to InterceptedHtlcResponse and wiring them through rpcInterceptorResponse.

FailureMessage accepts a pre-encrypted onion error blob. When set, lnd relays the bytes through IntermediateEncrypt rather than constructing a new error with EncryptFirstHop. This allows a virtual node behind the interceptor to produce errors attributed to itself instead of the intercepting node.

FailureCode selects a specific failure code for errors that lnd constructs on behalf of the intercepting node. Without either field, lnd defaults to TemporaryChannelFailure.

Pull Request Checklist

  • PR is opened against correct version branch.
  • Version compatibility matrix in the README and minimal required version
    in lnd_services.go are updated.
  • Update macaroon_recipes.go if your PR adds a new method that is called
    differently than the RPC method it invokes.

@saubyk saubyk added this to v0.21 Mar 17, 2026
@saubyk saubyk moved this to In progress in v0.21 Mar 17, 2026
@Roasbeef Roasbeef changed the base branch from master to lnd-21-0 March 19, 2026 18:20
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🫆

The HTLC interception response type was missing fields for controlling
how lnd encodes failure errors back to the sender. Without these fields,
all interceptor failures are encoded as TemporaryChannelFailure and
attributed to the intercepting node, which causes Mission Control to
penalize the forwarding pair.

This adds FailureMessage and FailureCode to InterceptedHtlcResponse and
wires them through rpcInterceptorResponse. FailureMessage accepts a
pre-encrypted onion error blob that lnd relays via IntermediateEncrypt,
preserving the error attribution of the original encrypter. This is the
path a virtual node behind the interceptor uses to produce errors
attributed to itself rather than the intercepting node. FailureCode
selects a specific failure code for errors attributed to the interceptor.
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.

3 participants