@@ -24,7 +24,6 @@ use lightning::util::logger::Logger;
2424
2525use core:: fmt:: Debug ;
2626use core:: ops:: Deref ;
27- use core:: time:: Duration ;
2827
2928/// Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`].
3029///
@@ -117,7 +116,7 @@ fn pay_invoice_using_amount<P: Deref>(
117116 recipient_onion. payment_metadata = invoice. payment_metadata ( ) . map ( |v| v. clone ( ) ) ;
118117 let mut payment_params = PaymentParameters :: from_node_id ( invoice. recover_payee_pub_key ( ) ,
119118 invoice. min_final_cltv_expiry_delta ( ) as u32 )
120- . with_expiry_time ( expiry_time_from_unix_epoch ( invoice) . as_secs ( ) )
119+ . with_expiry_time ( invoice. expires_at ( ) . unwrap ( ) . as_secs ( ) )
121120 . with_route_hints ( invoice. route_hints ( ) ) . unwrap ( ) ;
122121 if let Some ( features) = invoice. features ( ) {
123122 payment_params = payment_params. with_bolt11_features ( features. clone ( ) ) . unwrap ( ) ;
@@ -149,7 +148,7 @@ where C::Target: AChannelManager,
149148 invoice. recover_payee_pub_key ( ) ,
150149 invoice. min_final_cltv_expiry_delta ( ) as u32 ,
151150 )
152- . with_expiry_time ( expiry_time_from_unix_epoch ( invoice) . as_secs ( ) )
151+ . with_expiry_time ( invoice. expires_at ( ) . unwrap ( ) . as_secs ( ) )
153152 . with_route_hints ( invoice. route_hints ( ) )
154153 . unwrap ( ) ;
155154
@@ -180,7 +179,7 @@ where C::Target: AChannelManager,
180179 invoice. recover_payee_pub_key ( ) ,
181180 invoice. min_final_cltv_expiry_delta ( ) as u32 ,
182181 )
183- . with_expiry_time ( expiry_time_from_unix_epoch ( invoice) . as_secs ( ) )
182+ . with_expiry_time ( invoice. expires_at ( ) . unwrap ( ) . as_secs ( ) )
184183 . with_route_hints ( invoice. route_hints ( ) )
185184 . unwrap ( ) ;
186185
@@ -193,10 +192,6 @@ where C::Target: AChannelManager,
193192 . map_err ( ProbingError :: Sending )
194193}
195194
196- fn expiry_time_from_unix_epoch ( invoice : & Bolt11Invoice ) -> Duration {
197- invoice. signed_invoice . raw_invoice . data . timestamp . 0 + invoice. expiry_time ( )
198- }
199-
200195/// An error that may occur when making a payment.
201196#[ derive( Clone , Debug , PartialEq , Eq ) ]
202197pub enum PaymentError {
0 commit comments