fix(lightning): improve error message for unsupported LND partial self-payments - #1113
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1113 +/- ##
==========================================
+ Coverage 74.35% 74.45% +0.09%
==========================================
Files 115 115
Lines 13155 13160 +5
==========================================
+ Hits 9782 9798 +16
+ Misses 3373 3362 -11 ☔ View full report in Codecov by Harness. |
Hardeezah
force-pushed
the
feat/lnd-allow-self-payment
branch
from
August 12, 2026 11:26
1fcd02f to
efd6ce1
Compare
callebtc
approved these changes
Aug 13, 2026
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.
Description
Refs #1112
Partial (MPP) self-payments fail because the manual routing path used by
pay_partial_invoice(QueryRoutes+SendToRouteV2, and the REST equivalents) cannot forwardallow_self_payment: neitherQueryRoutesRequestnorSendToRouteRequestexposes the flag, while onlySendPaymentRequestdoes. A functional fix (routing partial payments throughSendPaymentV2's manualdest/amt/payment_hashshard mode) is tracked separately in #1112.This PR is a UX stopgap: it does not enable partial self-payments. When
MINT_LND_ALLOW_SELF_PAYMENTis enabled and a partial-payment failure matches the known pathfinding-failure strings (target not found/no route), it appends a note explaining that the cause is an upstream LND limitation on theQueryRoutespath. This lets a mint operator distinguish an expected self-payment failure from an unexpected routing problem.Changes Made
cashu/lightning/lnd_grpc/lnd_grpc.py: inpay_partial_invoice, when theQueryRoutes/SendToRouteV2call raisesAioRpcErrorand the errormessage contains
target not foundorno route, append the note if theself-payment setting is enabled.
cashu/lightning/lndrest.py: same handling for the route-fetch errorbranch of
pay_partial_invoice.tests/lightning/test_lnd_partial_mocked.py: parametrized tests for bothbackends covering the note appended (setting enabled) and unchanged error
(setting disabled).
Caveats
target not found/no routeis best-effort and LND-version-dependent; the tests assert the note only when these exact substrings appear.Testing
make checkclean (Ruff + mypy)make testlocal suite passes; new tests cover all modified lines