projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement non-strict forwarding
[rust-lightning]
/
lightning
/
src
/
offers
/
offer.rs
diff --git
a/lightning/src/offers/offer.rs
b/lightning/src/offers/offer.rs
index 762bc1f3306555947f8a44aff9799547965753f5..dd58c75cec27e600e803122d72d92036665b0976 100644
(file)
--- a/
lightning/src/offers/offer.rs
+++ b/
lightning/src/offers/offer.rs
@@
-664,6
+664,12
@@
impl Offer {
pub fn expects_quantity(&self) -> bool {
self.contents.expects_quantity()
}
pub fn expects_quantity(&self) -> bool {
self.contents.expects_quantity()
}
+
+ pub(super) fn verify<T: secp256k1::Signing>(
+ &self, key: &ExpandedKey, secp_ctx: &Secp256k1<T>
+ ) -> Result<(OfferId, Option<Keypair>), ()> {
+ self.contents.verify(&self.bytes, key, secp_ctx)
+ }
}
macro_rules! request_invoice_derived_payer_id { ($self: ident, $builder: ty) => {
}
macro_rules! request_invoice_derived_payer_id { ($self: ident, $builder: ty) => {
@@
-966,6
+972,13
@@
impl OfferContents {
}
}
}
}
+impl Readable for Offer {
+ fn read<R: io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
+ let bytes: WithoutLength<Vec<u8>> = Readable::read(reader)?;
+ Self::try_from(bytes.0).map_err(|_| DecodeError::InvalidValue)
+ }
+}
+
impl Writeable for Offer {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
WithoutLength(&self.bytes).write(writer)
impl Writeable for Offer {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
WithoutLength(&self.bytes).write(writer)