Skip to content

Commit eeabac8

Browse files
authored
Merge pull request #922 from valentinewallace/update-default-expiry
Correct default invoice expiry
2 parents 0b1f0a7 + 4503ef3 commit eeabac8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn get_payment_secret_hash(dest: &ChanMan, payment_id: &mut u8) -> Option<(Payme
272272
let mut payment_hash;
273273
for _ in 0..256 {
274274
payment_hash = PaymentHash(Sha256::hash(&[*payment_id; 1]).into_inner());
275-
if let Ok(payment_secret) = dest.create_inbound_payment_for_hash(payment_hash, None, 7200, 0) {
275+
if let Ok(payment_secret) = dest.create_inbound_payment_for_hash(payment_hash, None, 3600, 0) {
276276
return Some((payment_secret, payment_hash));
277277
}
278278
*payment_id = payment_id.wrapping_add(1);

lightning-invoice/src/utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Convenient utilities to create an invoice.
2-
use {Currency, Invoice, InvoiceBuilder, SignOrCreationError, RawInvoice};
2+
use {Currency, DEFAULT_EXPIRY_TIME, Invoice, InvoiceBuilder, SignOrCreationError, RawInvoice};
33
use bech32::ToBase32;
44
use bitcoin_hashes::Hash;
55
use lightning::chain;
@@ -9,6 +9,7 @@ use lightning::ln::channelmanager::{ChannelManager, MIN_FINAL_CLTV_EXPIRY};
99
use lightning::routing::network_graph::RoutingFees;
1010
use lightning::routing::router::RouteHintHop;
1111
use lightning::util::logger::Logger;
12+
use std::convert::TryInto;
1213
use std::ops::Deref;
1314

1415
/// Utility to construct an invoice. Generally, unless you want to do something like a custom
@@ -54,7 +55,7 @@ where
5455

5556
let (payment_hash, payment_secret) = channelmanager.create_inbound_payment(
5657
amt_msat,
57-
7200, // default invoice expiry is 2 hours
58+
DEFAULT_EXPIRY_TIME.try_into().unwrap(),
5859
0,
5960
);
6061
let our_node_pubkey = channelmanager.get_our_node_id();

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34773477
/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
34783478
/// in excess of the current time. This should roughly match the expiry time set in the invoice.
34793479
/// After this many seconds, we will remove the inbound payment, resulting in any attempts to
3480-
/// pay the invoice failing. The BOLT spec suggests 7,200 secs as a default validity time for
3480+
/// pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
34813481
/// invoices when no timeout is set.
34823482
///
34833483
/// Note that we use block header time to time-out pending inbound payments (with some margin

0 commit comments

Comments
 (0)