@@ -4204,7 +4204,7 @@ where
4204
4204
///
4205
4205
/// [timer tick]: Self::timer_tick_occurred
4206
4206
pub fn send_payment_for_bolt12_invoice(
4207
- &self, invoice: &Bolt12Invoice, context: &OffersContext,
4207
+ &self, invoice: &Bolt12Invoice, context: Option< &OffersContext> ,
4208
4208
) -> Result<(), Bolt12PaymentError> {
4209
4209
match self.verify_bolt12_invoice(invoice, context) {
4210
4210
Ok(payment_id) => self.send_payment_for_verified_bolt12_invoice(invoice, payment_id),
@@ -4213,17 +4213,17 @@ where
4213
4213
}
4214
4214
4215
4215
fn verify_bolt12_invoice(
4216
- &self, invoice: &Bolt12Invoice, context: &OffersContext,
4216
+ &self, invoice: &Bolt12Invoice, context: Option< &OffersContext> ,
4217
4217
) -> Result<PaymentId, ()> {
4218
4218
let secp_ctx = &self.secp_ctx;
4219
4219
let expanded_key = &self.inbound_payment_key;
4220
4220
4221
4221
match context {
4222
- OffersContext::Unknown {} if invoice.is_for_refund_without_paths() => {
4222
+ None if invoice.is_for_refund_without_paths() => {
4223
4223
invoice.verify_using_metadata(expanded_key, secp_ctx)
4224
4224
},
4225
- OffersContext::OutboundPayment { payment_id, nonce } => {
4226
- invoice.verify_using_payer_data(* payment_id, * nonce, expanded_key, secp_ctx)
4225
+ Some(& OffersContext::OutboundPayment { payment_id, nonce }) => {
4226
+ invoice.verify_using_payer_data(payment_id, nonce, expanded_key, secp_ctx)
4227
4227
},
4228
4228
_ => Err(()),
4229
4229
}
@@ -10713,13 +10713,17 @@ where
10713
10713
R::Target: Router,
10714
10714
L::Target: Logger,
10715
10715
{
10716
- fn handle_message(&self, message: OffersMessage, context: OffersContext, responder: Option<Responder>) -> ResponseInstruction<OffersMessage> {
10716
+ fn handle_message(
10717
+ &self, message: OffersMessage, context: Option<OffersContext>, responder: Option<Responder>,
10718
+ ) -> ResponseInstruction<OffersMessage> {
10717
10719
let secp_ctx = &self.secp_ctx;
10718
10720
let expanded_key = &self.inbound_payment_key;
10719
10721
10720
10722
let abandon_if_payment = |context| {
10721
10723
match context {
10722
- OffersContext::OutboundPayment { payment_id, .. } => self.abandon_payment(payment_id),
10724
+ Some(OffersContext::OutboundPayment { payment_id, .. }) => {
10725
+ self.abandon_payment(payment_id)
10726
+ },
10723
10727
_ => {},
10724
10728
}
10725
10729
};
@@ -10732,8 +10736,8 @@ where
10732
10736
};
10733
10737
10734
10738
let nonce = match context {
10735
- OffersContext::Unknown {} if invoice_request.metadata().is_some() => None,
10736
- OffersContext::InvoiceRequest { nonce } => Some(nonce),
10739
+ None if invoice_request.metadata().is_some() => None,
10740
+ Some( OffersContext::InvoiceRequest { nonce }) => Some(nonce),
10737
10741
_ => return ResponseInstruction::NoResponse,
10738
10742
};
10739
10743
@@ -10828,7 +10832,7 @@ where
10828
10832
}
10829
10833
},
10830
10834
OffersMessage::Invoice(invoice) => {
10831
- let payment_id = match self.verify_bolt12_invoice(&invoice, & context) {
10835
+ let payment_id = match self.verify_bolt12_invoice(&invoice, context.as_ref() ) {
10832
10836
Ok(payment_id) => payment_id,
10833
10837
Err(()) => return ResponseInstruction::NoResponse,
10834
10838
};
@@ -10889,7 +10893,7 @@ where
10889
10893
},
10890
10894
OffersMessage::InvoiceError(invoice_error) => {
10891
10895
let payment_hash = match context {
10892
- OffersContext::InboundPayment { payment_hash } => Some(payment_hash),
10896
+ Some( OffersContext::InboundPayment { payment_hash }) => Some(payment_hash),
10893
10897
_ => None,
10894
10898
};
10895
10899
let logger = WithContext::from(&self.logger, None, None, payment_hash);
0 commit comments