@@ -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 }
@@ -10713,13 +10713,17 @@ where
1071310713 R::Target: Router,
1071410714 L::Target: Logger,
1071510715{
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> {
1071710719 let secp_ctx = &self.secp_ctx;
1071810720 let expanded_key = &self.inbound_payment_key;
1071910721
1072010722 let abandon_if_payment = |context| {
1072110723 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+ },
1072310727 _ => {},
1072410728 }
1072510729 };
@@ -10732,8 +10736,8 @@ where
1073210736 };
1073310737
1073410738 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),
1073710741 _ => return ResponseInstruction::NoResponse,
1073810742 };
1073910743
@@ -10828,7 +10832,7 @@ where
1082810832 }
1082910833 },
1083010834 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() ) {
1083210836 Ok(payment_id) => payment_id,
1083310837 Err(()) => return ResponseInstruction::NoResponse,
1083410838 };
@@ -10889,7 +10893,7 @@ where
1088910893 },
1089010894 OffersMessage::InvoiceError(invoice_error) => {
1089110895 let payment_hash = match context {
10892- OffersContext::InboundPayment { payment_hash } => Some(payment_hash),
10896+ Some( OffersContext::InboundPayment { payment_hash }) => Some(payment_hash),
1089310897 _ => None,
1089410898 };
1089510899 let logger = WithContext::from(&self.logger, None, None, payment_hash);
0 commit comments