File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -431,8 +431,9 @@ pub enum Quantity {
431
431
impl Quantity {
432
432
fn new ( quantity : Option < u64 > ) -> Self {
433
433
match quantity {
434
- Some ( 1 ) | None => Quantity :: One ,
434
+ None => Quantity :: One ,
435
435
Some ( 0 ) => Quantity :: Many ,
436
+ Some ( 1 ) => unreachable ! ( ) ,
436
437
Some ( n) => Quantity :: Max ( NonZeroU64 :: new ( n) . unwrap ( ) ) ,
437
438
}
438
439
}
@@ -515,7 +516,10 @@ impl TryFrom<OfferTlvStream> for OfferContents {
515
516
paths => paths,
516
517
} ;
517
518
518
- let supported_quantity = Quantity :: new ( quantity_max) ;
519
+ let supported_quantity = match quantity_max {
520
+ Some ( 1 ) => return Err ( SemanticError :: InvalidQuantity ) ,
521
+ _ => Quantity :: new ( quantity_max) ,
522
+ } ;
519
523
520
524
if node_id. is_none ( ) {
521
525
return Err ( SemanticError :: MissingNodeId ) ;
Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ pub enum SemanticError {
80
80
MissingNodeId ,
81
81
/// An empty set of blinded paths was provided.
82
82
MissingPaths ,
83
+ /// An unsupported quantity was provided.
84
+ InvalidQuantity ,
83
85
}
84
86
85
87
impl From < bech32:: Error > for ParseError {
You can’t perform that action at this time.
0 commit comments