]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Clean up invoice handling result logic
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 16 May 2024 21:14:59 +0000 (16:14 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 11 Jun 2024 16:05:32 +0000 (11:05 -0500)
lightning/src/ln/channelmanager.rs

index 815c0b46003b840cf544d80c465255fad1f3aee0..9ef63973ddc02f3c348746e9e76401c2bfef1e9c 100644 (file)
@@ -10277,7 +10277,7 @@ where
                                }
                        },
                        OffersMessage::Invoice(invoice) => {
-                               let response = invoice
+                               let result = invoice
                                        .verify(expanded_key, secp_ctx)
                                        .map_err(|()| InvoiceError::from_string("Unrecognized invoice".to_owned()))
                                        .and_then(|payment_id| {
@@ -10293,16 +10293,15 @@ where
                                                }
                                        });
 
-                               match (responder, response) {
-                                       (Some(responder), Err(e)) => responder.respond(OffersMessage::InvoiceError(e)),
-                                       (None, Err(_)) => {
-                                               log_trace!(
-                                                       self.logger,
-                                                       "A response was generated, but there is no reply_path specified for sending the response."
-                                               );
-                                               ResponseInstruction::NoResponse
-                                       }
-                                       _ => ResponseInstruction::NoResponse,
+                               match result {
+                                       Ok(()) => ResponseInstruction::NoResponse,
+                                       Err(e) => match responder {
+                                               Some(responder) => responder.respond(OffersMessage::InvoiceError(e)),
+                                               None => {
+                                                       log_trace!(self.logger, "No reply path for sending invoice error: {:?}", e);
+                                                       ResponseInstruction::NoResponse
+                                               },
+                                       },
                                }
                        },
                        OffersMessage::InvoiceError(invoice_error) => {