Skip to content

Commit 6002032

Browse files
committed
f - DRY up PositiveTimestamp
1 parent 26a44c2 commit 6002032

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lightning-invoice/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,7 @@ impl PositiveTimestamp {
936936
///
937937
/// Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
938938
pub fn from_unix_timestamp(unix_seconds: u64) -> Result<Self, CreationError> {
939-
if unix_seconds > MAX_TIMESTAMP {
940-
Err(CreationError::TimestampOutOfBounds)
941-
} else {
942-
Ok(PositiveTimestamp(Duration::from_secs(unix_seconds)))
943-
}
939+
Self::from_duration_since_epoch(Duration::from_secs(unix_seconds))
944940
}
945941

946942
/// Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding unix timestamp in

0 commit comments

Comments
 (0)