Skip to content

Commit 21451c5

Browse files
committed
f - check exceeding MAX_VALUE_MSAT
1 parent 683a71c commit 21451c5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lightning/src/offers/invoice_request.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ mod tests {
466466
#[cfg(feature = "std")]
467467
use core::time::Duration;
468468
use crate::ln::features::InvoiceRequestFeatures;
469-
use crate::ln::msgs::DecodeError;
469+
use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT};
470470
use crate::offers::offer::{OfferBuilder, Quantity};
471471
use crate::offers::parse::{ParseError, SemanticError};
472472
use crate::util::ser::{BigSize, Writeable};
@@ -704,6 +704,16 @@ mod tests {
704704
Err(e) => assert_eq!(e, SemanticError::InsufficientAmount),
705705
}
706706

707+
match OfferBuilder::new("foo".into(), recipient_pubkey())
708+
.amount_msats(1000)
709+
.build().unwrap()
710+
.request_invoice(vec![1; 32], payer_pubkey())
711+
.amount_msats(MAX_VALUE_MSAT + 1)
712+
{
713+
Ok(_) => panic!("expected error"),
714+
Err(e) => assert_eq!(e, SemanticError::InvalidAmount),
715+
}
716+
707717
match OfferBuilder::new("foo".into(), recipient_pubkey())
708718
.amount_msats(1000)
709719
.supported_quantity(Quantity::Unbounded)

0 commit comments

Comments
 (0)