Skip to content

Commit a3a49e5

Browse files
committed
Add _delta suffix to min_final_cltv_expiry
This matches the spec and helps avoid any confusion around naming. We're also then consistent with `cltv_expiry` in an HTLC being the actual block height value for the CLTV and not a delta.
1 parent 437fa4f commit a3a49e5

File tree

7 files changed

+58
-58
lines changed

7 files changed

+58
-58
lines changed

lightning-invoice/src/de.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use secp256k1;
2222
use secp256k1::ecdsa::{RecoveryId, RecoverableSignature};
2323
use secp256k1::PublicKey;
2424

25-
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
25+
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiryDelta, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
2626
SemanticError, PrivateRoute, ParseError, ParseOrSemanticError, Description, RawTaggedField, Currency, RawHrp, SiPrefix, RawInvoice,
2727
constants, SignedRawInvoice, RawDataPart, InvoiceFeatures};
2828

@@ -451,8 +451,8 @@ impl FromBase32 for TaggedField {
451451
Ok(TaggedField::DescriptionHash(Sha256::from_base32(field_data)?)),
452452
constants::TAG_EXPIRY_TIME =>
453453
Ok(TaggedField::ExpiryTime(ExpiryTime::from_base32(field_data)?)),
454-
constants::TAG_MIN_FINAL_CLTV_EXPIRY =>
455-
Ok(TaggedField::MinFinalCltvExpiry(MinFinalCltvExpiry::from_base32(field_data)?)),
454+
constants::TAG_MIN_FINAL_CLTV_EXPIRY_DELTA =>
455+
Ok(TaggedField::MinFinalCltvExpiryDelta(MinFinalCltvExpiryDelta::from_base32(field_data)?)),
456456
constants::TAG_FALLBACK =>
457457
Ok(TaggedField::Fallback(Fallback::from_base32(field_data)?)),
458458
constants::TAG_PRIVATE_ROUTE =>
@@ -523,13 +523,13 @@ impl FromBase32 for ExpiryTime {
523523
}
524524
}
525525

526-
impl FromBase32 for MinFinalCltvExpiry {
526+
impl FromBase32 for MinFinalCltvExpiryDelta {
527527
type Err = ParseError;
528528

529-
fn from_base32(field_data: &[u5]) -> Result<MinFinalCltvExpiry, ParseError> {
529+
fn from_base32(field_data: &[u5]) -> Result<MinFinalCltvExpiryDelta, ParseError> {
530530
let expiry = parse_int_be::<u64, u5>(field_data, 32);
531531
if let Some(expiry) = expiry {
532-
Ok(MinFinalCltvExpiry(expiry))
532+
Ok(MinFinalCltvExpiryDelta(expiry))
533533
} else {
534534
Err(ParseError::IntegerOverflowError)
535535
}
@@ -840,14 +840,14 @@ mod test {
840840
}
841841

842842
#[test]
843-
fn test_parse_min_final_cltv_expiry() {
844-
use crate::MinFinalCltvExpiry;
843+
fn test_parse_min_final_cltv_expiry_delta() {
844+
use crate::MinFinalCltvExpiryDelta;
845845
use bech32::FromBase32;
846846

847847
let input = from_bech32("pr".as_bytes());
848-
let expected = Ok(MinFinalCltvExpiry(35));
848+
let expected = Ok(MinFinalCltvExpiryDelta(35));
849849

850-
assert_eq!(MinFinalCltvExpiry::from_base32(&input), expected);
850+
assert_eq!(MinFinalCltvExpiryDelta::from_base32(&input), expected);
851851
}
852852

853853
#[test]

lightning-invoice/src/lib.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ pub const DEFAULT_EXPIRY_TIME: u64 = 3600;
154154
/// Default minimum final CLTV expiry as defined by [BOLT 11].
155155
///
156156
/// Note that this is *not* the same value as rust-lightning's minimum CLTV expiry, which is
157-
/// provided in [`MIN_FINAL_CLTV_EXPIRY`].
157+
/// provided in [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
158158
///
159159
/// [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md
160-
/// [`MIN_FINAL_CLTV_EXPIRY`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY
161-
pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY: u64 = 18;
160+
/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
161+
pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA: u64 = 18;
162162

163163
/// Builder for `Invoice`s. It's the most convenient and advised way to use this library. It ensures
164164
/// that only a semantically and syntactically correct Invoice can be built using it.
@@ -199,7 +199,7 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY: u64 = 18;
199199
/// .payment_hash(payment_hash)
200200
/// .payment_secret(payment_secret)
201201
/// .current_timestamp()
202-
/// .min_final_cltv_expiry(144)
202+
/// .min_final_cltv_expiry_delta(144)
203203
/// .build_signed(|hash| {
204204
/// Secp256k1::new().sign_ecdsa_recoverable(hash, &private_key)
205205
/// })
@@ -410,7 +410,7 @@ pub enum TaggedField {
410410
PayeePubKey(PayeePubKey),
411411
DescriptionHash(Sha256),
412412
ExpiryTime(ExpiryTime),
413-
MinFinalCltvExpiry(MinFinalCltvExpiry),
413+
MinFinalCltvExpiryDelta(MinFinalCltvExpiryDelta),
414414
Fallback(Fallback),
415415
PrivateRoute(PrivateRoute),
416416
PaymentSecret(PaymentSecret),
@@ -438,9 +438,9 @@ pub struct PayeePubKey(pub PublicKey);
438438
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
439439
pub struct ExpiryTime(Duration);
440440

441-
/// `min_final_cltv_expiry` to use for the last HTLC in the route
441+
/// `min_final_cltv_expiry_delta` to use for the last HTLC in the route
442442
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
443-
pub struct MinFinalCltvExpiry(pub u64);
443+
pub struct MinFinalCltvExpiryDelta(pub u64);
444444

445445
// TODO: better types instead onf byte arrays
446446
/// Fallback address in case no LN payment is possible
@@ -475,7 +475,7 @@ pub mod constants {
475475
pub const TAG_PAYEE_PUB_KEY: u8 = 19;
476476
pub const TAG_DESCRIPTION_HASH: u8 = 23;
477477
pub const TAG_EXPIRY_TIME: u8 = 6;
478-
pub const TAG_MIN_FINAL_CLTV_EXPIRY: u8 = 24;
478+
pub const TAG_MIN_FINAL_CLTV_EXPIRY_DELTA: u8 = 24;
479479
pub const TAG_FALLBACK: u8 = 9;
480480
pub const TAG_PRIVATE_ROUTE: u8 = 3;
481481
pub const TAG_PAYMENT_SECRET: u8 = 16;
@@ -654,9 +654,9 @@ impl<D: tb::Bool, H: tb::Bool, C: tb::Bool, S: tb::Bool> InvoiceBuilder<D, H, tb
654654
}
655655

656656
impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, S: tb::Bool> InvoiceBuilder<D, H, T, tb::False, S> {
657-
/// Sets `min_final_cltv_expiry`.
658-
pub fn min_final_cltv_expiry(mut self, min_final_cltv_expiry: u64) -> InvoiceBuilder<D, H, T, tb::True, S> {
659-
self.tagged_fields.push(TaggedField::MinFinalCltvExpiry(MinFinalCltvExpiry(min_final_cltv_expiry)));
657+
/// Sets `min_final_cltv_expiry_delta`.
658+
pub fn min_final_cltv_expiry_delta(mut self, min_final_cltv_expiry_delta: u64) -> InvoiceBuilder<D, H, T, tb::True, S> {
659+
self.tagged_fields.push(TaggedField::MinFinalCltvExpiryDelta(MinFinalCltvExpiryDelta(min_final_cltv_expiry_delta)));
660660
self.set_flags()
661661
}
662662
}
@@ -929,8 +929,8 @@ impl RawInvoice {
929929
find_extract!(self.known_tagged_fields(), TaggedField::ExpiryTime(ref x), x)
930930
}
931931

932-
pub fn min_final_cltv_expiry(&self) -> Option<&MinFinalCltvExpiry> {
933-
find_extract!(self.known_tagged_fields(), TaggedField::MinFinalCltvExpiry(ref x), x)
932+
pub fn min_final_cltv_expiry_delta(&self) -> Option<&MinFinalCltvExpiryDelta> {
933+
find_extract!(self.known_tagged_fields(), TaggedField::MinFinalCltvExpiryDelta(ref x), x)
934934
}
935935

936936
pub fn payment_secret(&self) -> Option<&PaymentSecret> {
@@ -1243,12 +1243,12 @@ impl Invoice {
12431243
.unwrap_or_else(|| Duration::new(u64::max_value(), 1_000_000_000 - 1)) < at_time
12441244
}
12451245

1246-
/// Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
1247-
/// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
1248-
pub fn min_final_cltv_expiry(&self) -> u64 {
1249-
self.signed_invoice.min_final_cltv_expiry()
1246+
/// Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise
1247+
/// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`].
1248+
pub fn min_final_cltv_expiry_delta(&self) -> u64 {
1249+
self.signed_invoice.min_final_cltv_expiry_delta()
12501250
.map(|x| x.0)
1251-
.unwrap_or(DEFAULT_MIN_FINAL_CLTV_EXPIRY)
1251+
.unwrap_or(DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA)
12521252
}
12531253

12541254
/// Returns a list of all fallback addresses
@@ -1301,7 +1301,7 @@ impl TaggedField {
13011301
TaggedField::PayeePubKey(_) => constants::TAG_PAYEE_PUB_KEY,
13021302
TaggedField::DescriptionHash(_) => constants::TAG_DESCRIPTION_HASH,
13031303
TaggedField::ExpiryTime(_) => constants::TAG_EXPIRY_TIME,
1304-
TaggedField::MinFinalCltvExpiry(_) => constants::TAG_MIN_FINAL_CLTV_EXPIRY,
1304+
TaggedField::MinFinalCltvExpiryDelta(_) => constants::TAG_MIN_FINAL_CLTV_EXPIRY_DELTA,
13051305
TaggedField::Fallback(_) => constants::TAG_FALLBACK,
13061306
TaggedField::PrivateRoute(_) => constants::TAG_PRIVATE_ROUTE,
13071307
TaggedField::PaymentSecret(_) => constants::TAG_PAYMENT_SECRET,
@@ -1804,7 +1804,7 @@ mod test {
18041804
let builder = InvoiceBuilder::new(Currency::Bitcoin)
18051805
.payment_hash(sha256::Hash::from_slice(&[0;32][..]).unwrap())
18061806
.duration_since_epoch(Duration::from_secs(1234567))
1807-
.min_final_cltv_expiry(144);
1807+
.min_final_cltv_expiry_delta(144);
18081808

18091809
let too_long_string = String::from_iter(
18101810
(0..1024).map(|_| '?')
@@ -1922,7 +1922,7 @@ mod test {
19221922
.duration_since_epoch(Duration::from_secs(1234567))
19231923
.payee_pub_key(public_key.clone())
19241924
.expiry_time(Duration::from_secs(54321))
1925-
.min_final_cltv_expiry(144)
1925+
.min_final_cltv_expiry_delta(144)
19261926
.fallback(Fallback::PubKeyHash([0;20]))
19271927
.private_route(route_1.clone())
19281928
.private_route(route_2.clone())
@@ -1948,7 +1948,7 @@ mod test {
19481948
);
19491949
assert_eq!(invoice.payee_pub_key(), Some(&public_key));
19501950
assert_eq!(invoice.expiry_time(), Duration::from_secs(54321));
1951-
assert_eq!(invoice.min_final_cltv_expiry(), 144);
1951+
assert_eq!(invoice.min_final_cltv_expiry_delta(), 144);
19521952
assert_eq!(invoice.fallbacks(), vec![&Fallback::PubKeyHash([0;20])]);
19531953
assert_eq!(invoice.private_routes(), vec![&PrivateRoute(route_1), &PrivateRoute(route_2)]);
19541954
assert_eq!(
@@ -1989,7 +1989,7 @@ mod test {
19891989
.unwrap();
19901990
let invoice = Invoice::from_signed(signed_invoice).unwrap();
19911991

1992-
assert_eq!(invoice.min_final_cltv_expiry(), DEFAULT_MIN_FINAL_CLTV_EXPIRY);
1992+
assert_eq!(invoice.min_final_cltv_expiry_delta(), DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA);
19931993
assert_eq!(invoice.expiry_time(), Duration::from_secs(DEFAULT_EXPIRY_TIME));
19941994
assert!(!invoice.would_expire(Duration::from_secs(1234568)));
19951995
}

lightning-invoice/src/payment.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ where
429429
let route_params = RouteParameters {
430430
payment_params,
431431
final_value_msat: invoice.amount_milli_satoshis().or(amount_msats).unwrap(),
432-
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
432+
final_cltv_expiry_delta: invoice.min_final_cltv_expiry_delta() as u32,
433433
};
434434

435435
let send_payment = |route: &Route| {
@@ -760,7 +760,7 @@ mod tests {
760760
.payment_hash(payment_hash)
761761
.payment_secret(PaymentSecret([0; 32]))
762762
.duration_since_epoch(duration_since_epoch())
763-
.min_final_cltv_expiry(144)
763+
.min_final_cltv_expiry_delta(144)
764764
.amount_milli_satoshis(128)
765765
.build_signed(|hash| {
766766
Secp256k1::new().sign_ecdsa_recoverable(hash, &private_key)
@@ -786,7 +786,7 @@ mod tests {
786786
.payment_hash(payment_hash)
787787
.payment_secret(PaymentSecret([0; 32]))
788788
.duration_since_epoch(duration_since_epoch())
789-
.min_final_cltv_expiry(144)
789+
.min_final_cltv_expiry_delta(144)
790790
.build_signed(|hash| {
791791
Secp256k1::new().sign_ecdsa_recoverable(hash, &private_key)
792792
})
@@ -805,7 +805,7 @@ mod tests {
805805
.payment_hash(payment_hash)
806806
.payment_secret(PaymentSecret([0; 32]))
807807
.duration_since_epoch(duration)
808-
.min_final_cltv_expiry(144)
808+
.min_final_cltv_expiry_delta(144)
809809
.amount_milli_satoshis(128)
810810
.build_signed(|hash| {
811811
Secp256k1::new().sign_ecdsa_recoverable(hash, &private_key)
@@ -1661,7 +1661,7 @@ mod tests {
16611661
RouteParameters {
16621662
payment_params,
16631663
final_value_msat,
1664-
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
1664+
final_cltv_expiry_delta: invoice.min_final_cltv_expiry_delta() as u32,
16651665
}
16661666
}
16671667
}

lightning-invoice/src/ser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::fmt::{Display, Formatter};
33
use bech32::{ToBase32, u5, WriteBase32, Base32Len};
44
use crate::prelude::*;
55

6-
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiry, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
6+
use super::{Invoice, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiryDelta, Fallback, PayeePubKey, InvoiceSignature, PositiveTimestamp,
77
PrivateRoute, Description, RawTaggedField, Currency, RawHrp, SiPrefix, constants, SignedRawInvoice, RawDataPart};
88

99
/// Converts a stream of bytes written to it to base32. On finalization the according padding will
@@ -313,13 +313,13 @@ impl Base32Len for ExpiryTime {
313313
}
314314
}
315315

316-
impl ToBase32 for MinFinalCltvExpiry {
316+
impl ToBase32 for MinFinalCltvExpiryDelta {
317317
fn write_base32<W: WriteBase32>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err> {
318318
writer.write(&encode_int_be_base32(self.0))
319319
}
320320
}
321321

322-
impl Base32Len for MinFinalCltvExpiry {
322+
impl Base32Len for MinFinalCltvExpiryDelta {
323323
fn base32_len(&self) -> usize {
324324
encoded_int_be_base32_size(self.0)
325325
}
@@ -434,8 +434,8 @@ impl ToBase32 for TaggedField {
434434
TaggedField::ExpiryTime(ref duration) => {
435435
write_tagged_field(writer, constants::TAG_EXPIRY_TIME, duration)
436436
},
437-
TaggedField::MinFinalCltvExpiry(ref expiry) => {
438-
write_tagged_field(writer, constants::TAG_MIN_FINAL_CLTV_EXPIRY, expiry)
437+
TaggedField::MinFinalCltvExpiryDelta(ref expiry) => {
438+
write_tagged_field(writer, constants::TAG_MIN_FINAL_CLTV_EXPIRY_DELTA, expiry)
439439
},
440440
TaggedField::Fallback(ref fallback_address) => {
441441
write_tagged_field(writer, constants::TAG_FALLBACK, fallback_address)

lightning-invoice/src/utils.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use lightning::chain;
1010
use lightning::chain::chaininterface::{BroadcasterInterface, FeeEstimator};
1111
use lightning::chain::keysinterface::{Recipient, NodeSigner, SignerProvider, EntropySource};
1212
use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
13-
use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, MIN_FINAL_CLTV_EXPIRY};
13+
use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, MIN_FINAL_CLTV_EXPIRY_DELTA};
1414
#[cfg(feature = "std")]
1515
use lightning::ln::channelmanager::{PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA};
1616
use lightning::ln::inbound_payment::{create, create_from_hash, ExpandedKey};
@@ -179,7 +179,7 @@ where
179179
.current_timestamp()
180180
.payment_hash(Hash::from_slice(&payment_hash.0).unwrap())
181181
.payment_secret(payment_secret)
182-
.min_final_cltv_expiry(MIN_FINAL_CLTV_EXPIRY.into())
182+
.min_final_cltv_expiry_delta(MIN_FINAL_CLTV_EXPIRY_DELTA.into())
183183
.expiry_time(Duration::from_secs(invoice_expiry_delta_secs.into()));
184184
if let Some(amt) = amt_msat {
185185
invoice = invoice.amount_milli_satoshis(amt);
@@ -435,7 +435,7 @@ fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_has
435435
.payment_hash(Hash::from_slice(&payment_hash.0).unwrap())
436436
.payment_secret(payment_secret)
437437
.basic_mpp()
438-
.min_final_cltv_expiry(MIN_FINAL_CLTV_EXPIRY.into())
438+
.min_final_cltv_expiry_delta(MIN_FINAL_CLTV_EXPIRY_DELTA.into())
439439
.expiry_time(Duration::from_secs(invoice_expiry_delta_secs.into()));
440440
if let Some(amt) = amt_msat {
441441
invoice = invoice.amount_milli_satoshis(amt);
@@ -642,7 +642,7 @@ mod test {
642642
use bitcoin_hashes::sha256::Hash as Sha256;
643643
use lightning::chain::keysinterface::{EntropySource, PhantomKeysManager};
644644
use lightning::ln::{PaymentPreimage, PaymentHash};
645-
use lightning::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY, PaymentId};
645+
use lightning::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId};
646646
use lightning::ln::functional_test_utils::*;
647647
use lightning::ln::msgs::ChannelMessageHandler;
648648
use lightning::routing::router::{PaymentParameters, RouteParameters, find_route};
@@ -665,7 +665,7 @@ mod test {
665665
Some(10_000), "test".to_string(), Duration::from_secs(1234567),
666666
non_default_invoice_expiry_secs).unwrap();
667667
assert_eq!(invoice.amount_pico_btc(), Some(100_000));
668-
assert_eq!(invoice.min_final_cltv_expiry(), MIN_FINAL_CLTV_EXPIRY as u64);
668+
assert_eq!(invoice.min_final_cltv_expiry_delta(), MIN_FINAL_CLTV_EXPIRY_DELTA as u64);
669669
assert_eq!(invoice.description(), InvoiceDescription::Direct(&Description("test".to_string())));
670670
assert_eq!(invoice.expiry_time(), Duration::from_secs(non_default_invoice_expiry_secs.into()));
671671

@@ -685,7 +685,7 @@ mod test {
685685
let route_params = RouteParameters {
686686
payment_params,
687687
final_value_msat: invoice.amount_milli_satoshis().unwrap(),
688-
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
688+
final_cltv_expiry_delta: invoice.min_final_cltv_expiry_delta() as u32,
689689
};
690690
let first_hops = nodes[0].node.list_usable_channels();
691691
let network_graph = &node_cfgs[0].network_graph;
@@ -731,7 +731,7 @@ mod test {
731731
Some(10_000), description_hash, Duration::from_secs(1234567), 3600
732732
).unwrap();
733733
assert_eq!(invoice.amount_pico_btc(), Some(100_000));
734-
assert_eq!(invoice.min_final_cltv_expiry(), MIN_FINAL_CLTV_EXPIRY as u64);
734+
assert_eq!(invoice.min_final_cltv_expiry_delta(), MIN_FINAL_CLTV_EXPIRY_DELTA as u64);
735735
assert_eq!(invoice.description(), InvoiceDescription::Hash(&crate::Sha256(Sha256::hash("Testing description_hash".as_bytes()))));
736736
}
737737

@@ -997,7 +997,7 @@ mod test {
997997
nodes[1].node.get_payment_preimage(payment_hash, payment_secret).unwrap()
998998
};
999999

1000-
assert_eq!(invoice.min_final_cltv_expiry(), MIN_FINAL_CLTV_EXPIRY as u64);
1000+
assert_eq!(invoice.min_final_cltv_expiry_delta(), MIN_FINAL_CLTV_EXPIRY_DELTA as u64);
10011001
assert_eq!(invoice.description(), InvoiceDescription::Direct(&Description("test".to_string())));
10021002
assert_eq!(invoice.route_hints().len(), 2);
10031003
assert_eq!(invoice.expiry_time(), Duration::from_secs(non_default_invoice_expiry_secs.into()));
@@ -1009,7 +1009,7 @@ mod test {
10091009
let params = RouteParameters {
10101010
payment_params,
10111011
final_value_msat: invoice.amount_milli_satoshis().unwrap(),
1012-
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
1012+
final_cltv_expiry_delta: invoice.min_final_cltv_expiry_delta() as u32,
10131013
};
10141014
let first_hops = nodes[0].node.list_usable_channels();
10151015
let network_graph = &node_cfgs[0].network_graph;
@@ -1130,7 +1130,7 @@ mod test {
11301130
)
11311131
.unwrap();
11321132
assert_eq!(invoice.amount_pico_btc(), Some(200_000));
1133-
assert_eq!(invoice.min_final_cltv_expiry(), MIN_FINAL_CLTV_EXPIRY as u64);
1133+
assert_eq!(invoice.min_final_cltv_expiry_delta(), MIN_FINAL_CLTV_EXPIRY_DELTA as u64);
11341134
assert_eq!(invoice.expiry_time(), Duration::from_secs(non_default_invoice_expiry_secs.into()));
11351135
assert_eq!(invoice.description(), InvoiceDescription::Hash(&crate::Sha256(Sha256::hash("Description hash phantom invoice".as_bytes()))));
11361136
}

lightning-invoice/tests/ser_de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawInvoice, bool, bool)> {
246246
"462264ede7e14047e9b249da94fefc47f41f7d02ee9b091815a5506bc8abf75f"
247247
).unwrap())
248248
.expiry_time(Duration::from_secs(604800))
249-
.min_final_cltv_expiry(10)
249+
.min_final_cltv_expiry_delta(10)
250250
.description("Blockstream Store: 88.85 USD for Blockstream Ledger Nano S x 1, \"Back In My Day\" Sticker x 2, \"I Got Lightning Working\" Sticker x 2 and 1 more items".to_owned())
251251
.private_route(RouteHint(vec![RouteHintHop {
252252
src_node_id: PublicKey::from_slice(&hex::decode(

0 commit comments

Comments
 (0)