mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
invoice: invert check to reduce indentation.
Instead of doing command_fail() in the else, do it immediately then unindent the normal path. No code changes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5becfa6ee1
commit
85cb302b65
@ -1701,17 +1701,20 @@ static struct command_result *json_createinvoice(struct command *cmd,
|
||||
} else {
|
||||
struct tlv_invoice *inv;
|
||||
struct sha256 *local_offer_id;
|
||||
|
||||
inv = invoice_decode_nosig(cmd, invstring, strlen(invstring),
|
||||
cmd->ld->our_features, chainparams,
|
||||
&fail);
|
||||
if (inv) {
|
||||
char *b12enc;
|
||||
struct amount_msat msat;
|
||||
const char *desc;
|
||||
u32 expiry;
|
||||
enum offer_status status;
|
||||
|
||||
inv = invoice_decode_nosig(cmd, invstring, strlen(invstring),
|
||||
cmd->ld->our_features, chainparams,
|
||||
&fail);
|
||||
if (!inv)
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"Unparsable invoice '%s': %s",
|
||||
invstring, fail);
|
||||
|
||||
if (inv->signature)
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"invoice already signed");
|
||||
@ -1766,10 +1769,6 @@ static struct command_result *json_createinvoice(struct command *cmd,
|
||||
notify_invoice_creation(cmd->ld,
|
||||
inv->amount ? &msat : NULL,
|
||||
*preimage, label);
|
||||
} else
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"Unparsable invoice '%s': %s",
|
||||
invstring, fail);
|
||||
}
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user