Skip to content

Commit 1173e06

Browse files
committed
Clean up invoice handling result logic
1 parent bccdf0d commit 1173e06

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10277,7 +10277,7 @@ where
1027710277
}
1027810278
},
1027910279
OffersMessage::Invoice(invoice) => {
10280-
let response = invoice
10280+
let result = invoice
1028110281
.verify(expanded_key, secp_ctx)
1028210282
.map_err(|()| InvoiceError::from_string("Unrecognized invoice".to_owned()))
1028310283
.and_then(|payment_id| {
@@ -10293,16 +10293,15 @@ where
1029310293
}
1029410294
});
1029510295

10296-
match (responder, response) {
10297-
(Some(responder), Err(e)) => responder.respond(OffersMessage::InvoiceError(e)),
10298-
(None, Err(_)) => {
10299-
log_trace!(
10300-
self.logger,
10301-
"A response was generated, but there is no reply_path specified for sending the response."
10302-
);
10303-
ResponseInstruction::NoResponse
10304-
}
10305-
_ => ResponseInstruction::NoResponse,
10296+
match result {
10297+
Ok(()) => ResponseInstruction::NoResponse,
10298+
Err(e) => match responder {
10299+
Some(responder) => responder.respond(OffersMessage::InvoiceError(e)),
10300+
None => {
10301+
log_trace!(self.logger, "No reply path for sending invoice error: {:?}", e);
10302+
ResponseInstruction::NoResponse
10303+
},
10304+
},
1030610305
}
1030710306
},
1030810307
OffersMessage::InvoiceError(invoice_error) => {

0 commit comments

Comments
 (0)