projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Docs improvements
[rust-lightning]
/
lightning
/
src
/
offers
/
offer.rs
diff --git
a/lightning/src/offers/offer.rs
b/lightning/src/offers/offer.rs
index a535b378250afbd335bf790680c3f157f75d042c..405e2e278d8073eac345a801f88906422989f173 100644
(file)
--- a/
lightning/src/offers/offer.rs
+++ b/
lightning/src/offers/offer.rs
@@
-242,7
+242,7
@@
impl OfferBuilder {
///
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
/// [`Invoice`]: crate::offers::invoice::Invoice
///
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
/// [`Invoice`]: crate::offers::invoice::Invoice
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug
, PartialEq
)]
pub struct Offer {
// The serialized offer. Needed when creating an `InvoiceRequest` if the offer contains unknown
// fields.
pub struct Offer {
// The serialized offer. Needed when creating an `InvoiceRequest` if the offer contains unknown
// fields.
@@
-254,7
+254,7
@@
pub struct Offer {
///
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
/// [`Invoice`]: crate::offers::invoice::Invoice
///
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
/// [`Invoice`]: crate::offers::invoice::Invoice
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug
, PartialEq
)]
pub(super) struct OfferContents {
chains: Option<Vec<ChainHash>>,
metadata: Option<Vec<u8>>,
pub(super) struct OfferContents {
chains: Option<Vec<ChainHash>>,
metadata: Option<Vec<u8>>,
@@
-431,7
+431,8
@@
impl OfferContents {
};
if !self.expects_quantity() || quantity.is_some() {
};
if !self.expects_quantity() || quantity.is_some() {
- let expected_amount_msats = offer_amount_msats * quantity.unwrap_or(1);
+ let expected_amount_msats = offer_amount_msats.checked_mul(quantity.unwrap_or(1))
+ .ok_or(SemanticError::InvalidAmount)?;
let amount_msats = amount_msats.unwrap_or(expected_amount_msats);
if amount_msats < expected_amount_msats {
let amount_msats = amount_msats.unwrap_or(expected_amount_msats);
if amount_msats < expected_amount_msats {