Skip to content

Commit fc1e87a

Browse files
rename pay_parameters for no amount invoice
This commit renames the function `pay_parameters_for_zero_amount_invoice` to `pay_parameters_for_variable_amount_invoice`. The term "variable amount" is used to align with the naming convention in the LDK node, helping to avoid confusion between similar packages. Fixes: #2879 Replaces: #2979 Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 76a93a3 commit fc1e87a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lightning/src/ln/bolt11_payment.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use crate::ln::channelmanager::RecipientOnionFields;
1616
use crate::routing::router::{PaymentParameters, RouteParameters};
1717
use crate::types::payment::PaymentHash;
1818

19-
/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount
20-
/// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
21-
/// [`ChannelManager::send_preflight_probes`].
19+
/// Builds the necessary parameters to pay or pre-flight probe the given any-amount
20+
/// (also known as 'zero-amount') [`Bolt11Invoice`] using
21+
/// [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`].
2222
///
2323
/// Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
2424
/// same [`PaymentHash`] has never been paid before.
@@ -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)