Skip to content

Commit ac80b2f

Browse files
committed
f - remove signature from offer
1 parent e77e38d commit ac80b2f

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

lightning/src/offers/offer.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl_writeable!(OnionMessagePath, { node_id, encrypted_recipient_data });
364364
type Empty = ();
365365

366366
/// An offer parsed from a bech32-encoded string as a TLV stream and the corresponding bytes. The
367-
/// latter is used for signature verification.
367+
/// latter is used to compute the offer id.
368368
struct ParsedOffer(OfferTlvStream, Vec<u8>);
369369

370370
/// Error when parsing a bech32 encoded message using [`str::parse`].
@@ -399,8 +399,6 @@ pub enum SemanticError {
399399
MissingPaths,
400400
///
401401
InvalidQuantity,
402-
///
403-
InvalidSignature(secp256k1::Error),
404402
}
405403

406404
impl From<bech32::Error> for ParseError {
@@ -421,12 +419,6 @@ impl From<SemanticError> for ParseError {
421419
}
422420
}
423421

424-
impl From<secp256k1::Error> for SemanticError {
425-
fn from(error: secp256k1::Error) -> Self {
426-
Self::InvalidSignature(error)
427-
}
428-
}
429-
430422
impl FromStr for Offer {
431423
type Err = ParseError;
432424

@@ -441,7 +433,7 @@ impl TryFrom<ParsedOffer> for Offer {
441433
fn try_from(offer: ParsedOffer) -> Result<Self, Self::Error> {
442434
let ParsedOffer(OfferTlvStream {
443435
chains, metadata, currency, amount, description, features, absolute_expiry, paths,
444-
issuer, quantity_min, quantity_max, node_id, send_invoice, signature,
436+
issuer, quantity_min, quantity_max, node_id, send_invoice,
445437
}, data) = offer;
446438

447439
let supported_chains = [
@@ -508,16 +500,10 @@ impl TryFrom<ParsedOffer> for Offer {
508500
let send_invoice = send_invoice.map(|_| SendInvoice);
509501

510502
let id = merkle::root_hash(&data);
511-
if let Some(signature) = &signature {
512-
let digest = Offer::message_digest(id);
513-
let secp_ctx = Secp256k1::verification_only();
514-
let pubkey = Offer::node_id_from_parts(node_id, paths.as_ref());
515-
secp_ctx.verify_schnorr(signature, &digest, &pubkey.into())?;
516-
}
517503

518504
Ok(Offer {
519505
id, chains, metadata, amount, description, features, absolute_expiry, issuer, paths,
520-
quantity_min, quantity_max, node_id, send_invoice, signature,
506+
quantity_min, quantity_max, node_id, send_invoice,
521507
})
522508
}
523509
}

0 commit comments

Comments
 (0)