-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify Bolt11 Payments and Remove Redundant Code #3617
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This needs rebase now.
Some upcoming changes require a new `PaymentFailure` variant to handle cases where a Bolt11 invoice specifies an invalid amount. This commit introduces the variant, setting the stage for its usage in subsequent commits.
Previously, paying a Bolt11 invoice required manually extracting the `payment_id`, `payment_hash`, and other parameters before passing them to `send_payment`. This commit introduces `pay_for_bolt11_invoice`, bringing the same simplicity already available for Bolt12 invoices. It allows users to pass the entire Bolt11 invoice directly while also supporting custom routing parameters via `RouteParametersConfig`.
With `pay_for_bolt11_invoice` now handling payment and route parameter extraction within `ChannelManager`, the utility functions in `bolt11_payment.rs` have become unnecessary. This commit removes the redundant code and associated tests, streamlining the implementation.
Updated from pr3617.02 to pr3617.03 (diff): Changes:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3617 +/- ##
==========================================
- Coverage 88.60% 88.57% -0.03%
==========================================
Files 151 150 -1
Lines 118454 118377 -77
Branches 118454 118377 -77
==========================================
- Hits 104957 104856 -101
- Misses 10985 10990 +5
- Partials 2512 2531 +19 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
resolves #3262
builds on: #3342
Summary
This PR introduces
pay_for_bolt11_invoice
, simplifying how Bolt11 payments are processed by allowing direct invoice-based payments while still enabling custom routing parameters. With this change, the redundantbolt11_payment.rs
utility functions are no longer needed and have been removed.Why This Change?
payment_id
,payment_hash
, and other parameters before passing them tosend_payment
.pay_for_bolt11_invoice
introduces a more streamlined approach, mirroring the existing convenience of Bolt12 payments.ChannelManager
,bolt11_payment.rs
is redundant and can be safely removed.Changes
pay_for_bolt11_invoice
:RouteParametersConfig
.bolt11_payment.rs
:ChannelManager
.Impact