Skip to content

Conversation

@shruti2522
Copy link

fix #2462

  • implemented the following in outbound_payment.rs :

    • if the router tells us the payment is to ourselves, we build a simple one-hop route and treat it like a local payment
    • when preimage is available, immediately claim the HTLC
  • added test case self_spontaneous_payment_fulfills() to test self payment

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 20, 2026

👋 I see @valentinewallace was un-assigned.
If you'd like another reviewer assignment, please click here.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

This violates a number of the API constraints on sending payments - specifically, someone could send a payment, then restart and they wouldn't see the pending payment, thinking they hadn't "sent" it. Check out some of the early feedback on the first attempt at this #2573

@TheBlueMatt TheBlueMatt removed the request for review from valentinewallace January 20, 2026 21:51
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 92.55319% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.54%. Comparing base (7785360) to head (e5498e0).

Files with missing lines Patch % Lines
lightning/src/ln/outbound_payment.rs 92.55% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4328      +/-   ##
==========================================
+ Coverage   86.53%   86.54%   +0.01%     
==========================================
  Files         158      158              
  Lines      103188   103280      +92     
  Branches   103188   103280      +92     
==========================================
+ Hits        89292    89385      +93     
  Misses      11471    11471              
+ Partials     2425     2424       -1     
Flag Coverage Δ
fuzzing 37.03% <12.76%> (-0.05%) ⬇️
tests 85.84% <92.55%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shruti2522
Copy link
Author

This violates a number of the API constraints on sending payments - specifically, someone could send a payment, then restart and they wouldn't see the pending payment, thinking they hadn't "sent" it. Check out some of the early feedback on the first attempt at this #2573

I reworked this based on feedback in #2573 . We now try routing first and only fall back to a self-payment check if it fails, so explicit self-routes still work for rebalancing. I have also added phantom node support. this implementation reuses existing code without adding new ChannelManager fields. PaymentClaimable is still left since it’s a bigger change, should i implement it here?
please take a look @TheBlueMatt

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.

Allow self-payment

3 participants