@@ -162,7 +162,8 @@ fn _create_phantom_invoice<Signer: Sign, K: Deref>(
162
162
. current_timestamp ( )
163
163
. payment_hash ( Hash :: from_slice ( & payment_hash. 0 ) . unwrap ( ) )
164
164
. payment_secret ( payment_secret)
165
- . min_final_cltv_expiry ( MIN_FINAL_CLTV_EXPIRY . into ( ) ) ;
165
+ . min_final_cltv_expiry ( MIN_FINAL_CLTV_EXPIRY . into ( ) )
166
+ . expiry_time ( Duration :: from_secs ( invoice_expiry_delta_secs. into ( ) ) ) ;
166
167
if let Some ( amt) = amt_msat {
167
168
invoice = invoice. amount_milli_satoshis ( amt) ;
168
169
}
@@ -811,6 +812,7 @@ mod test {
811
812
assert_eq ! ( invoice. min_final_cltv_expiry( ) , MIN_FINAL_CLTV_EXPIRY as u64 ) ;
812
813
assert_eq ! ( invoice. description( ) , InvoiceDescription :: Direct ( & Description ( "test" . to_string( ) ) ) ) ;
813
814
assert_eq ! ( invoice. route_hints( ) . len( ) , 2 ) ;
815
+ assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( 3600 ) ) ;
814
816
assert ! ( !invoice. features( ) . unwrap( ) . supports_basic_mpp( ) ) ;
815
817
816
818
let payment_params = PaymentParameters :: from_node_id ( invoice. recover_payee_pub_key ( ) )
@@ -931,10 +933,17 @@ mod test {
931
933
] ;
932
934
933
935
let description_hash = crate :: Sha256 ( Hash :: hash ( "Description hash phantom invoice" . as_bytes ( ) ) ) ;
934
- let invoice = :: utils:: create_phantom_invoice_with_description_hash :: < EnforcingSigner , & test_utils:: TestKeysInterface > ( Some ( payment_amt) , None , 3600 , description_hash, route_hints, & nodes[ 1 ] . keys_manager , Currency :: BitcoinTestnet ) . unwrap ( ) ;
935
-
936
+ let non_default_invoice_expiry_secs = 4200 ;
937
+ let invoice = :: utils:: create_phantom_invoice_with_description_hash :: <
938
+ EnforcingSigner , & test_utils:: TestKeysInterface ,
939
+ > (
940
+ Some ( payment_amt) , None , non_default_invoice_expiry_secs, description_hash,
941
+ route_hints, & nodes[ 1 ] . keys_manager , Currency :: BitcoinTestnet
942
+ )
943
+ . unwrap ( ) ;
936
944
assert_eq ! ( invoice. amount_pico_btc( ) , Some ( 200_000 ) ) ;
937
945
assert_eq ! ( invoice. min_final_cltv_expiry( ) , MIN_FINAL_CLTV_EXPIRY as u64 ) ;
946
+ assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
938
947
assert_eq ! ( invoice. description( ) , InvoiceDescription :: Hash ( & crate :: Sha256 ( Sha256 :: hash( "Description hash phantom invoice" . as_bytes( ) ) ) ) ) ;
939
948
}
940
949
0 commit comments