From: Jeffrey Czyz Date: Thu, 16 May 2024 21:14:59 +0000 (-0500) Subject: Clean up invoice handling result logic X-Git-Tag: v0.0.124-beta~82^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1173e06f38bc1f3143883a478341ab4657057a29;p=rust-lightning Clean up invoice handling result logic --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 815c0b460..9ef63973d 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -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) => {