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
refactored payment_parameters_from_zero_amount_invoice
to amount-less
#2979
base: main
Are you sure you want to change the base?
refactored payment_parameters_from_zero_amount_invoice
to amount-less
#2979
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.
The changes look good. Just one small nit.
I think it will be a good idea to amend the payment_parameters_from_amount_less_invoice
documentation so that readers can understand that zero-amount invoices are synonymous with amount-less invoices in this context.
Ohk will add the documentation |
@shaavan should I add the doc just below this ? rust-lightning/lightning-invoice/src/payment.rs Lines 19 to 28 in 9325070
|
I was thinking maybe something simple like this may also work /// Builds the necessary parameters to pay or pre-flight probe the given zero-amount
-/// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
+/// (amount-less) [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
/// [`ChannelManager::send_preflight_probes`]. But feel free to handle it in whichever way you prefer! |
Got it 👍 |
lightning-invoice/src/payment.rs
Outdated
@@ -28,7 +28,7 @@ use lightning::routing::router::{PaymentParameters, RouteParameters}; | |||
/// | |||
/// [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment | |||
/// [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes | |||
pub fn payment_parameters_from_zero_amount_invoice(invoice: &Bolt11Invoice, amount_msat: u64) | |||
pub fn payment_parameters_from_amount_less_invoice(invoice: &Bolt11Invoice, amount_msat: u64) |
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.
Should be either amountless
(one word) or no_amount
, I think.
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.
refactoring to amountless
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2979 +/- ##
==========================================
- Coverage 89.38% 89.08% -0.30%
==========================================
Files 117 118 +1
Lines 95513 97492 +1979
Branches 95513 97492 +1979
==========================================
+ Hits 85376 86854 +1478
- Misses 7913 8387 +474
- Partials 2224 2251 +27 ☔ View full report in Codecov by Sentry. |
lightning-invoice/src/payment.rs
Outdated
/// An amount-less invoice, also known as a zero-amount invoice, refers to an invoice | ||
/// where the amount to be paid is zero. In this context, both terms are used synonymously. |
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.
I think the added docs are conveying the wrong message here.
A zero-amount invoice doesn't mean the amount to be paid is zero, but rather any arbitrary amount can be paid by the sender. For context, this answer might be helpful.
Also, FWIW, we don't need to explain the meaning of zero-amount invoice here, as the users of this function would most probably be aware of it.
That's why, I think a simple indication that zero-amount ≈ amountless will suffice here.
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.
Got it will change the docs accordingly
6442618
to
0b07165
Compare
62b0fa9
to
e897bf3
Compare
lightning-invoice/src/payment.rs
Outdated
@@ -17,7 +17,7 @@ use lightning::ln::channelmanager::RecipientOnionFields; | |||
use lightning::routing::router::{PaymentParameters, RouteParameters}; | |||
|
|||
/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount | |||
/// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or | |||
/// (amountless) [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or |
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.
Given the functions are called amountless, maybe we should say "amountless (sometimes referred to as zero-amount)"?
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.
- /// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
+ /// amountless (sometimes referred to as zero-amount) [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
like this ?
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.
Yes?
Please make your commit message more descriptive, see https://cbea.ms/git-commit/ for some guidelines. |
bac2f07
to
1c75d98
Compare
@@ -17,7 +17,7 @@ use lightning::ln::channelmanager::RecipientOnionFields; | |||
use lightning::routing::router::{PaymentParameters, RouteParameters}; | |||
|
|||
/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount | |||
/// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or | |||
/// amountless (sometimes referred to as zero-amount) [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or |
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.
This now reads "zero-amount amountless (sometimes referred to as zero-amount)"
1c75d98
to
c9ea33f
Compare
refactored the code related to zero_amount in the lightning payment invoice to use the term "amountless" instead
c9ea33f
to
e9d9a81
Compare
Fix #2879
Refactored
payment_parameters_from_zero_amount_invoice
toamount-less
as per the discussion in the issue