use crate::io;
use crate::io::Cursor;
use crate::ln::channelmanager::PaymentId;
-use crate::ln::onion_utils;
+use crate::ln::{PaymentHash, onion_utils};
use crate::offers::nonce::Nonce;
use crate::onion_message::packet::ControlTlvs;
use crate::sign::{NodeSigner, Recipient};
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
nonce: Nonce,
},
+ /// Context used by a [`BlindedPath`] as a reply path for a [`Bolt12Invoice`].
+ ///
+ /// This variant is intended to be received when handling an [`InvoiceError`].
+ ///
+ /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
+ InboundPayment {
+ /// The same payment hash as [`Bolt12Invoice::payment_hash`].
+ ///
+ /// [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash
+ payment_hash: PaymentHash,
+ },
}
impl_writeable_tlv_based_enum!(MessageContext,
(0, payment_id, required),
(1, nonce, required),
},
+ (3, InboundPayment) => {
+ (0, payment_hash, required),
+ },
);
/// Construct blinded onion message hops for the given `intermediate_nodes` and `recipient_node_id`.
}
},
OffersMessage::InvoiceError(invoice_error) => {
+ let payment_hash = match context {
+ OffersContext::InboundPayment { payment_hash } => Some(payment_hash),
+ _ => None,
+ };
+ let logger = WithContext::from(&self.logger, None, None, payment_hash);
+ log_trace!(logger, "Received invoice_error: {}", invoice_error);
+
abandon_if_payment(context);
- log_trace!(self.logger, "Received invoice_error: {}", invoice_error);
ResponseInstruction::NoResponse
},
}