@@ -24,7 +24,6 @@ use lightning::util::logger::Logger;
24
24
25
25
use core:: fmt:: Debug ;
26
26
use core:: ops:: Deref ;
27
- use core:: time:: Duration ;
28
27
29
28
/// Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`].
30
29
///
@@ -117,7 +116,7 @@ fn pay_invoice_using_amount<P: Deref>(
117
116
recipient_onion. payment_metadata = invoice. payment_metadata ( ) . map ( |v| v. clone ( ) ) ;
118
117
let mut payment_params = PaymentParameters :: from_node_id ( invoice. recover_payee_pub_key ( ) ,
119
118
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 ( ) )
121
120
. with_route_hints ( invoice. route_hints ( ) ) . unwrap ( ) ;
122
121
if let Some ( features) = invoice. features ( ) {
123
122
payment_params = payment_params. with_bolt11_features ( features. clone ( ) ) . unwrap ( ) ;
@@ -149,7 +148,7 @@ where C::Target: AChannelManager,
149
148
invoice. recover_payee_pub_key ( ) ,
150
149
invoice. min_final_cltv_expiry_delta ( ) as u32 ,
151
150
)
152
- . with_expiry_time ( expiry_time_from_unix_epoch ( invoice) . as_secs ( ) )
151
+ . with_expiry_time ( invoice. expires_at ( ) . unwrap ( ) . as_secs ( ) )
153
152
. with_route_hints ( invoice. route_hints ( ) )
154
153
. unwrap ( ) ;
155
154
@@ -180,7 +179,7 @@ where C::Target: AChannelManager,
180
179
invoice. recover_payee_pub_key ( ) ,
181
180
invoice. min_final_cltv_expiry_delta ( ) as u32 ,
182
181
)
183
- . with_expiry_time ( expiry_time_from_unix_epoch ( invoice) . as_secs ( ) )
182
+ . with_expiry_time ( invoice. expires_at ( ) . unwrap ( ) . as_secs ( ) )
184
183
. with_route_hints ( invoice. route_hints ( ) )
185
184
. unwrap ( ) ;
186
185
@@ -193,10 +192,6 @@ where C::Target: AChannelManager,
193
192
. map_err ( ProbingError :: Sending )
194
193
}
195
194
196
- fn expiry_time_from_unix_epoch ( invoice : & Bolt11Invoice ) -> Duration {
197
- invoice. signed_invoice . raw_invoice . data . timestamp . 0 + invoice. expiry_time ( )
198
- }
199
-
200
195
/// An error that may occur when making a payment.
201
196
#[ derive( Clone , Debug , PartialEq , Eq ) ]
202
197
pub enum PaymentError {
0 commit comments