@@ -154,11 +154,11 @@ pub const DEFAULT_EXPIRY_TIME: u64 = 3600;
154
154
/// Default minimum final CLTV expiry as defined by [BOLT 11].
155
155
///
156
156
/// 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 `].
158
158
///
159
159
/// [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 ;
162
162
163
163
/// Builder for `Invoice`s. It's the most convenient and advised way to use this library. It ensures
164
164
/// 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;
199
199
/// .payment_hash(payment_hash)
200
200
/// .payment_secret(payment_secret)
201
201
/// .current_timestamp()
202
- /// .min_final_cltv_expiry (144)
202
+ /// .min_final_cltv_expiry_delta (144)
203
203
/// .build_signed(|hash| {
204
204
/// Secp256k1::new().sign_ecdsa_recoverable(hash, &private_key)
205
205
/// })
@@ -438,7 +438,7 @@ pub struct PayeePubKey(pub PublicKey);
438
438
#[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
439
439
pub struct ExpiryTime ( Duration ) ;
440
440
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
442
442
#[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
443
443
pub struct MinFinalCltvExpiry ( pub u64 ) ;
444
444
@@ -475,7 +475,7 @@ pub mod constants {
475
475
pub const TAG_PAYEE_PUB_KEY : u8 = 19 ;
476
476
pub const TAG_DESCRIPTION_HASH : u8 = 23 ;
477
477
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 ;
479
479
pub const TAG_FALLBACK : u8 = 9 ;
480
480
pub const TAG_PRIVATE_ROUTE : u8 = 3 ;
481
481
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
654
654
}
655
655
656
656
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 :: MinFinalCltvExpiry ( MinFinalCltvExpiry ( min_final_cltv_expiry_delta ) ) ) ;
660
660
self . set_flags ( )
661
661
}
662
662
}
@@ -925,7 +925,7 @@ impl RawInvoice {
925
925
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: ExpiryTime ( ref x) , x)
926
926
}
927
927
928
- pub fn min_final_cltv_expiry ( & self ) -> Option < & MinFinalCltvExpiry > {
928
+ pub fn min_final_cltv_expiry_delta ( & self ) -> Option < & MinFinalCltvExpiry > {
929
929
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: MinFinalCltvExpiry ( ref x) , x)
930
930
}
931
931
@@ -1239,12 +1239,12 @@ impl Invoice {
1239
1239
. unwrap_or_else ( || Duration :: new ( u64:: max_value ( ) , 1_000_000_000 - 1 ) ) < at_time
1240
1240
}
1241
1241
1242
- /// Returns the invoice's `min_final_cltv_expiry ` time, if present, otherwise
1243
- /// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY `].
1244
- pub fn min_final_cltv_expiry ( & self ) -> u64 {
1245
- self . signed_invoice . min_final_cltv_expiry ( )
1242
+ /// Returns the invoice's `min_final_cltv_expiry_delta ` time, if present, otherwise
1243
+ /// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA `].
1244
+ pub fn min_final_cltv_expiry_delta ( & self ) -> u64 {
1245
+ self . signed_invoice . min_final_cltv_expiry_delta ( )
1246
1246
. map ( |x| x. 0 )
1247
- . unwrap_or ( DEFAULT_MIN_FINAL_CLTV_EXPIRY )
1247
+ . unwrap_or ( DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA )
1248
1248
}
1249
1249
1250
1250
/// Returns a list of all fallback addresses
@@ -1297,7 +1297,7 @@ impl TaggedField {
1297
1297
TaggedField :: PayeePubKey ( _) => constants:: TAG_PAYEE_PUB_KEY ,
1298
1298
TaggedField :: DescriptionHash ( _) => constants:: TAG_DESCRIPTION_HASH ,
1299
1299
TaggedField :: ExpiryTime ( _) => constants:: TAG_EXPIRY_TIME ,
1300
- TaggedField :: MinFinalCltvExpiry ( _) => constants:: TAG_MIN_FINAL_CLTV_EXPIRY ,
1300
+ TaggedField :: MinFinalCltvExpiry ( _) => constants:: TAG_MIN_FINAL_CLTV_EXPIRY_DELTA ,
1301
1301
TaggedField :: Fallback ( _) => constants:: TAG_FALLBACK ,
1302
1302
TaggedField :: PrivateRoute ( _) => constants:: TAG_PRIVATE_ROUTE ,
1303
1303
TaggedField :: PaymentSecret ( _) => constants:: TAG_PAYMENT_SECRET ,
@@ -1800,7 +1800,7 @@ mod test {
1800
1800
let builder = InvoiceBuilder :: new ( Currency :: Bitcoin )
1801
1801
. payment_hash ( sha256:: Hash :: from_slice ( & [ 0 ; 32 ] [ ..] ) . unwrap ( ) )
1802
1802
. duration_since_epoch ( Duration :: from_secs ( 1234567 ) )
1803
- . min_final_cltv_expiry ( 144 ) ;
1803
+ . min_final_cltv_expiry_delta ( 144 ) ;
1804
1804
1805
1805
let too_long_string = String :: from_iter (
1806
1806
( 0 ..1024 ) . map ( |_| '?' )
@@ -1918,7 +1918,7 @@ mod test {
1918
1918
. duration_since_epoch ( Duration :: from_secs ( 1234567 ) )
1919
1919
. payee_pub_key ( public_key. clone ( ) )
1920
1920
. expiry_time ( Duration :: from_secs ( 54321 ) )
1921
- . min_final_cltv_expiry ( 144 )
1921
+ . min_final_cltv_expiry_delta ( 144 )
1922
1922
. fallback ( Fallback :: PubKeyHash ( [ 0 ; 20 ] ) )
1923
1923
. private_route ( route_1. clone ( ) )
1924
1924
. private_route ( route_2. clone ( ) )
@@ -1944,7 +1944,7 @@ mod test {
1944
1944
) ;
1945
1945
assert_eq ! ( invoice. payee_pub_key( ) , Some ( & public_key) ) ;
1946
1946
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( 54321 ) ) ;
1947
- assert_eq ! ( invoice. min_final_cltv_expiry ( ) , 144 ) ;
1947
+ assert_eq ! ( invoice. min_final_cltv_expiry_delta ( ) , 144 ) ;
1948
1948
assert_eq ! ( invoice. fallbacks( ) , vec![ & Fallback :: PubKeyHash ( [ 0 ; 20 ] ) ] ) ;
1949
1949
assert_eq ! ( invoice. private_routes( ) , vec![ & PrivateRoute ( route_1) , & PrivateRoute ( route_2) ] ) ;
1950
1950
assert_eq ! (
@@ -1985,7 +1985,7 @@ mod test {
1985
1985
. unwrap ( ) ;
1986
1986
let invoice = Invoice :: from_signed ( signed_invoice) . unwrap ( ) ;
1987
1987
1988
- assert_eq ! ( invoice. min_final_cltv_expiry ( ) , DEFAULT_MIN_FINAL_CLTV_EXPIRY ) ;
1988
+ assert_eq ! ( invoice. min_final_cltv_expiry_delta ( ) , DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA ) ;
1989
1989
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( DEFAULT_EXPIRY_TIME ) ) ;
1990
1990
assert ! ( !invoice. would_expire( Duration :: from_secs( 1234568 ) ) ) ;
1991
1991
}
0 commit comments