Skip to content

Commit 6d641cf

Browse files
rename pay_parameters for no amount invoice
This commit renames the function pay_parameters_for_zero_amount_invoice to pay_parameters_for_any_amount_invoice. The reason for using the "any amount" naming convention is to reflect basic English language usage and align with other implementation naming conventions like [1]. Additionally, the term "any amount invoice" is also mentioned in the BOLT11 specification [2]. There was a previous attempt to rename the function to amount-less, but in my opinion, "any amount" is a more common naming convention. [1] https://github.com/ElementsProject/lightning/blob/b327bd30c32c034a8350460066b9e7354bfa4ba1/doc/schemas/lightning-invoice.json#L17 [2] https://github.com/lightning/bolts/blob/247e83d528a2a380e533e89f31918d7b0ce6a0c1/11-payment-encoding.md#examples Fixes: #2879 Replaces: #2979 Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 76a93a3 commit 6d641cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/ln/bolt11_payment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::types::payment::PaymentHash;
2828
///
2929
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3030
/// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes
31-
pub fn payment_parameters_from_zero_amount_invoice(
31+
pub fn payment_parameters_from_any_amount_invoice(
3232
invoice: &Bolt11Invoice, amount_msat: u64,
3333
) -> Result<(PaymentHash, RecipientOnionFields, RouteParameters), ()> {
3434
if invoice.amount_milli_satoshis().is_some() {
@@ -45,7 +45,7 @@ pub fn payment_parameters_from_zero_amount_invoice(
4545
/// same [`PaymentHash`] has never been paid before.
4646
///
4747
/// Will always succeed unless the invoice has no amount specified, in which case
48-
/// [`payment_parameters_from_zero_amount_invoice`] should be used.
48+
/// [`payment_parameters_from_any_amount_invoice`] should be used.
4949
///
5050
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5151
/// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes
@@ -112,7 +112,7 @@ mod tests {
112112
.build_signed(|hash| secp_ctx.sign_ecdsa_recoverable(hash, &private_key))
113113
.unwrap();
114114

115-
assert!(payment_parameters_from_zero_amount_invoice(&invoice, 42).is_err());
115+
assert!(payment_parameters_from_any_amount_invoice(&invoice, 42).is_err());
116116

117117
let (hash, onion, params) = payment_parameters_from_invoice(&invoice).unwrap();
118118
assert_eq!(&hash.0[..], &payment_hash[..]);
@@ -146,7 +146,7 @@ mod tests {
146146
assert!(payment_parameters_from_invoice(&invoice).is_err());
147147

148148
let (hash, onion, params) =
149-
payment_parameters_from_zero_amount_invoice(&invoice, 42).unwrap();
149+
payment_parameters_from_any_amount_invoice(&invoice, 42).unwrap();
150150
assert_eq!(&hash.0[..], &payment_hash[..]);
151151
assert_eq!(onion.payment_secret, Some(PaymentSecret([0; 32])));
152152
assert_eq!(params.final_value_msat, 42);

0 commit comments

Comments
 (0)