File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ const SYSTEM_TIME_MAX_UNIX_TIMESTAMP: u64 = std::i32::MAX as u64;
54
54
/// it should be rather low as long as we still have to support 32bit time representations
55
55
const MAX_EXPIRY_TIME : u64 = 60 * 60 * 24 * 356 ;
56
56
57
+ /// Default expiry time as defined by [BOLT 11].
58
+ ///
59
+ /// [BOLT 11]: https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md
60
+ const DEFAULT_EXPIRY_TIME : u64 = 3600 ;
61
+
57
62
/// This function is used as a static assert for the size of `SystemTime`. If the crate fails to
58
63
/// compile due to it this indicates that your system uses unexpected bounds for `SystemTime`. You
59
64
/// can remove this functions and run the test `test_system_time_bounds_assumptions`. In any case,
@@ -1021,11 +1026,11 @@ impl Invoice {
1021
1026
self . signed_invoice . recover_payee_pub_key ( ) . expect ( "was checked by constructor" ) . 0
1022
1027
}
1023
1028
1024
- /// Returns the invoice's expiry time if present
1029
+ /// Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
1025
1030
pub fn expiry_time ( & self ) -> Duration {
1026
1031
self . signed_invoice . expiry_time ( )
1027
1032
. map ( |x| x. 0 )
1028
- . unwrap_or ( Duration :: from_secs ( 3600 ) )
1033
+ . unwrap_or ( Duration :: from_secs ( DEFAULT_EXPIRY_TIME ) )
1029
1034
}
1030
1035
1031
1036
/// Returns the invoice's `min_cltv_expiry` time if present
You can’t perform that action at this time.
0 commit comments