Skip to content

allow_self_payment flag missing from QueryRoutes prevents partial self-payments #1112

Description

@Hardeezah

Issue

allow_self_payment cannot be forwarded on the partial-payment (MPP) path, so partial self-payments fail.

Background

Nutshell can pay Lightning invoices in full or as a partial (MPP) shard.
Full payments use SendPaymentV2, which supports LND's allow_self_payment flag (added in #1092, merged as #1107). Partial payments, however, use a manual routing flow: pay_partial_invoice builds the MPP record by hand and dispatches it with QueryRoutes + SendToRouteV2 (cashu/lightning/lnd_grpc/lnd_grpc.py:231-308) or the REST equivalents (cashu/lightning/lndrest.py:283-351).
SendPaymentV2 cannot be used with a payment request to send a single partial shard (it drives the payment to completion), and it has no field to set the MPP record's total_amt_msat, which is why the manual path exists.

Problem

The manual path cannot honor MINT_LND_ALLOW_SELF_PAYMENT because LND's request messages do not expose the flag:

  • QueryRoutesRequest — no allow_self_payment (cashu/lightning/lnd_grpc/protos/lightning.proto:2971)
  • SendToRouteRequest — no allow_self_payment (cashu/lightning/lnd_grpc/protos/lightning.proto:900 and router.proto:421)
    As a result, Nutshell cannot permit circular (self-)routing on the partial path, and partial self-payments fail in practice (typically with target not found / no route errors). The outcome is LND-version-dependent: QueryRoutes can produce self -> peer -> self routes in some versions (see lightningnetwork/lnd#7419, #10873), so the behavior is not reliably deterministic.

Impact on Nutshell

MINT_LND_ALLOW_SELF_PAYMENT is only honored on the full-payment path. A mint with the setting enabled can pay its own invoices in full, but any partial melt of a self-issued invoice fails.

Proposed Solution

Long-term (LND upstream): Add allow_self_payment to both QueryRoutesRequest and SendToRouteRequest so the manual path works unchanged. This cannot ship in Nutshell until the bundled protos match a supporting LND server.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions