File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,12 @@ impl<'a> InvoiceRequestBuilder<'a> {
140
140
/// Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed
141
141
/// by [`UnsignedInvoiceRequest::sign`].
142
142
pub fn build ( mut self ) -> Result < UnsignedInvoiceRequest < ' a > , SemanticError > {
143
+ #[ cfg( feature = "std" ) ] {
144
+ if self . offer . is_expired ( ) {
145
+ return Err ( SemanticError :: AlreadyExpired ) ;
146
+ }
147
+ }
148
+
143
149
let chain = self . invoice_request . chain ( ) ;
144
150
if !self . offer . supports_chain ( chain) {
145
151
return Err ( SemanticError :: UnsupportedChain ) ;
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ pub enum ParseError {
123
123
/// Error when interpreting a TLV stream as a specific type.
124
124
#[ derive( Debug , PartialEq ) ]
125
125
pub enum SemanticError {
126
+ /// The current [`std::time::SystemTime`] is past the offer or invoice's expiration.
127
+ AlreadyExpired ,
126
128
/// The provided chain hash does not correspond to a supported chain.
127
129
UnsupportedChain ,
128
130
/// An amount was expected but was missing.
You can’t perform that action at this time.
0 commit comments