Skip to content

Commit cdf670c

Browse files
committed
f - More idiomatic MAX_TIMESTAMP
1 parent 6002032 commit cdf670c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lightning-invoice/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ pub use de::{ParseError, ParseOrSemanticError};
8888
/// The number of bits used to represent timestamps as defined in BOLT 11.
8989
const TIMESTAMP_BITS: usize = 35;
9090

91-
/// The maximum timestamp that can be represented as a [`Duration`] since the UNIX epoch while
92-
/// allowing for adding an expiry without overflowing.
93-
const MAX_TIMESTAMP: u64 = core::u64::MAX >> (64 - TIMESTAMP_BITS);
91+
/// The maximum timestamp as [`Duration::as_secs`] since the UNIX epoch allowed by BOLT 11.
92+
const MAX_TIMESTAMP: u64 = (1 << TIMESTAMP_BITS) - 1;
9493

9594
/// Default expiry time as defined by [BOLT 11].
9695
///

0 commit comments

Comments
 (0)