@@ -9298,8 +9298,12 @@ where
9298
9298
let duration_since_epoch = {
9299
9299
use std::time::SystemTime;
9300
9300
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)
9301
- .expect("for the foreseeable future this shouldn't happen ")
9301
+ .expect("SystemTime::now() should be after SystemTime::UNIX_EPOCH ")
9302
9302
};
9303
+
9304
+ // This may be up to 2 hours in the future because of bitcoin's block time rule or about
9305
+ // 10-30 minutes in the past if a block hasn't been found recently. This should be fine as
9306
+ // the default invoice expiration is 2 hours, though shorter expirations may be problematic.
9303
9307
#[cfg(not(feature = "std"))]
9304
9308
let duration_since_epoch =
9305
9309
Duration::from_secs(self.highest_seen_timestamp.load(Ordering::Acquire) as u64);
@@ -9388,7 +9392,8 @@ pub struct Bolt11InvoiceParameters {
9388
9392
/// [`DEFAULT_EXPIRY_TIME`] by default.
9389
9393
///
9390
9394
/// The creation time used is the duration since the Unix epoch for `std` builds. For non-`std`
9391
- /// builds, the highest block timestamp seen is used instead.
9395
+ /// builds, the highest block timestamp seen is used instead. In the latter case, use a long
9396
+ /// enough expiry to account for the average block time.
9392
9397
pub invoice_expiry_delta_secs: Option<u32>,
9393
9398
9394
9399
/// The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use
0 commit comments