Skip to content

Commit 8924bf2

Browse files
fixup! Store invoice HTLCSource::OutboundRoute and ensure correct hashing
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent b9a07da commit 8924bf2

File tree

6 files changed

+8
-15
lines changed

6 files changed

+8
-15
lines changed

lightning/src/ln/outbound_payment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2033,7 +2033,7 @@ impl OutboundPayments {
20332033
payment_hash,
20342034
amount_msat,
20352035
fee_paid_msat,
2036-
bolt12_invoice: bolt12_invoice.clone(),
2036+
bolt12_invoice: bolt12_invoice,
20372037
}, Some(ev_completion_action.clone())));
20382038
payment.get_mut().mark_fulfilled();
20392039
}

lightning/src/offers/invoice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ pub(super) type BlindedPayInfoIter<'a> = core::iter::Map<
14951495
>;
14961496

14971497
/// Wire representation for an on-chain fallback address.
1498-
#[derive(Clone, Debug, PartialEq, Hash)]
1498+
#[derive(Clone, Debug, PartialEq)]
14991499
pub(super) struct FallbackAddress {
15001500
pub(super) version: u8,
15011501
pub(super) program: Vec<u8>,

lightning/src/offers/nonce.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::prelude::*;
2626
/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata
2727
/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey
2828
/// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey
29-
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
29+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3030
pub struct Nonce(pub(crate) [u8; Self::LENGTH]);
3131

3232
impl Nonce {

lightning/src/offers/offer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ pub struct Offer {
604604
///
605605
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
606606
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
607-
#[derive(Clone, Debug, Hash)]
607+
#[derive(Clone, Debug)]
608608
#[cfg_attr(test, derive(PartialEq))]
609609
pub(super) struct OfferContents {
610610
chains: Option<Vec<ChainHash>>,
@@ -1059,7 +1059,7 @@ impl Writeable for OfferContents {
10591059

10601060
/// The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
10611061
/// another currency.
1062-
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
1062+
#[derive(Clone, Copy, Debug, PartialEq)]
10631063
pub enum Amount {
10641064
/// An amount of bitcoin.
10651065
Bitcoin {
@@ -1079,7 +1079,7 @@ pub enum Amount {
10791079
pub type CurrencyCode = [u8; 3];
10801080

10811081
/// Quantity of items supported by an [`Offer`].
1082-
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
1082+
#[derive(Clone, Debug, PartialEq)]
10831083
pub enum Quantity {
10841084
/// Up to a specific number of items (inclusive). Use when more than one item can be requested
10851085
/// but is limited (e.g., because of per customer or inventory limits).

lightning/src/offers/signer.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const ASYNC_PAYMENTS_HELD_HTLC_HMAC_INPUT: &[u8; 16] = &[9; 16];
5757

5858
/// Message metadata which possibly is derived from [`MetadataMaterial`] such that it can be
5959
/// verified.
60-
#[derive(Clone, Hash)]
60+
#[derive(Clone)]
6161
pub(super) enum Metadata {
6262
/// Metadata as parsed, supplied by the user, or derived from the message contents.
6363
///
@@ -263,13 +263,6 @@ pub(super) struct MetadataMaterial {
263263
encrypted_payment_id: Option<[u8; PaymentId::LENGTH]>,
264264
}
265265

266-
impl core::hash::Hash for MetadataMaterial {
267-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
268-
self.nonce.hash(state);
269-
self.encrypted_payment_id.hash(state);
270-
}
271-
}
272-
273266
impl MetadataMaterial {
274267
pub fn new(nonce: Nonce, expanded_key: &ExpandedKey, payment_id: Option<PaymentId>) -> Self {
275268
// Encrypt payment_id

lightning/src/offers/static_invoice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl core::hash::Hash for StaticInvoice {
8989
/// The contents of a [`StaticInvoice`] for responding to an [`Offer`].
9090
///
9191
/// [`Offer`]: crate::offers::offer::Offer
92-
#[derive(Clone, Debug, Hash)]
92+
#[derive(Clone, Debug)]
9393
struct InvoiceContents {
9494
offer: OfferContents,
9595
payment_paths: Vec<BlindedPaymentPath>,

0 commit comments

Comments
 (0)