@@ -4204,7 +4204,7 @@ where
42044204 ///
42054205 /// [timer tick]: Self::timer_tick_occurred
42064206 pub fn send_payment_for_bolt12_invoice(
4207- &self, invoice: &Bolt12Invoice, context: &OffersContext,
4207+ &self, invoice: &Bolt12Invoice, context: Option< &OffersContext> ,
42084208 ) -> Result<(), Bolt12PaymentError> {
42094209 match self.verify_bolt12_invoice(invoice, context) {
42104210 Ok(payment_id) => self.send_payment_for_verified_bolt12_invoice(invoice, payment_id),
@@ -4213,17 +4213,17 @@ where
42134213 }
42144214
42154215 fn verify_bolt12_invoice(
4216- &self, invoice: &Bolt12Invoice, context: &OffersContext,
4216+ &self, invoice: &Bolt12Invoice, context: Option< &OffersContext> ,
42174217 ) -> Result<PaymentId, ()> {
42184218 let secp_ctx = &self.secp_ctx;
42194219 let expanded_key = &self.inbound_payment_key;
42204220
42214221 match context {
4222- OffersContext::Unknown {} if invoice.is_for_refund_without_paths() => {
4222+ None if invoice.is_for_refund_without_paths() => {
42234223 invoice.verify_using_metadata(expanded_key, secp_ctx)
42244224 },
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)
42274227 },
42284228 _ => Err(()),
42294229 }
@@ -10712,13 +10712,17 @@ where
1071210712 R::Target: Router,
1071310713 L::Target: Logger,
1071410714{
10715- fn handle_message(&self, message: OffersMessage, context: OffersContext, responder: Option<Responder>) -> ResponseInstruction<OffersMessage> {
10715+ fn handle_message(
10716+ &self, message: OffersMessage, context: Option<OffersContext>, responder: Option<Responder>,
10717+ ) -> ResponseInstruction<OffersMessage> {
1071610718 let secp_ctx = &self.secp_ctx;
1071710719 let expanded_key = &self.inbound_payment_key;
1071810720
1071910721 let abandon_if_payment = |context| {
1072010722 match context {
10721- OffersContext::OutboundPayment { payment_id, .. } => self.abandon_payment(payment_id),
10723+ Some(OffersContext::OutboundPayment { payment_id, .. }) => {
10724+ self.abandon_payment(payment_id)
10725+ },
1072210726 _ => {},
1072310727 }
1072410728 };
@@ -10731,8 +10735,8 @@ where
1073110735 };
1073210736
1073310737 let nonce = match context {
10734- OffersContext::Unknown {} if invoice_request.metadata().is_some() => None,
10735- OffersContext::InvoiceRequest { nonce } => Some(nonce),
10738+ None if invoice_request.metadata().is_some() => None,
10739+ Some( OffersContext::InvoiceRequest { nonce }) => Some(nonce),
1073610740 _ => return ResponseInstruction::NoResponse,
1073710741 };
1073810742
@@ -10827,7 +10831,7 @@ where
1082710831 }
1082810832 },
1082910833 OffersMessage::Invoice(invoice) => {
10830- let payment_id = match self.verify_bolt12_invoice(&invoice, & context) {
10834+ let payment_id = match self.verify_bolt12_invoice(&invoice, context.as_ref() ) {
1083110835 Ok(payment_id) => payment_id,
1083210836 Err(()) => return ResponseInstruction::NoResponse,
1083310837 };
@@ -10888,7 +10892,7 @@ where
1088810892 },
1088910893 OffersMessage::InvoiceError(invoice_error) => {
1089010894 let payment_hash = match context {
10891- OffersContext::InboundPayment { payment_hash } => Some(payment_hash),
10895+ Some( OffersContext::InboundPayment { payment_hash }) => Some(payment_hash),
1089210896 _ => None,
1089310897 };
1089410898 let logger = WithContext::from(&self.logger, None, None, payment_hash);
0 commit comments