Builder for creating invoices for offers
[rust-lightning] / lightning / src / offers / refund.rs
index f864e73a3d37f9d7052f5a818d7e176ebc2c7464..fdf763ecb952653dfadea965a5978fe5dd8e841e 100644 (file)
@@ -243,13 +243,7 @@ impl Refund {
        /// Whether the refund has expired.
        #[cfg(feature = "std")]
        pub fn is_expired(&self) -> bool {
-               match self.absolute_expiry() {
-                       Some(seconds_from_epoch) => match SystemTime::UNIX_EPOCH.elapsed() {
-                               Ok(elapsed) => elapsed > seconds_from_epoch,
-                               Err(_) => false,
-                       },
-                       None => false,
-               }
+               self.contents.is_expired()
        }
 
        /// The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
@@ -315,6 +309,17 @@ impl AsRef<[u8]> for Refund {
 }
 
 impl RefundContents {
+       #[cfg(feature = "std")]
+       pub(super) fn is_expired(&self) -> bool {
+               match self.absolute_expiry {
+                       Some(seconds_from_epoch) => match SystemTime::UNIX_EPOCH.elapsed() {
+                               Ok(elapsed) => elapsed > seconds_from_epoch,
+                               Err(_) => false,
+                       },
+                       None => false,
+               }
+       }
+
        pub(super) fn chain(&self) -> ChainHash {
                self.chain.unwrap_or_else(|| self.implied_chain())
        }