Skip to content

Commit

Permalink
fixup! lightningd: Add signinvoice to sign a BOLT11 invoice.
Browse files Browse the repository at this point in the history
Don't require expiry (the default is 1 hour), and allow
description-hash-only invoices.  Use a BOLT quote.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Feb 6, 2023
1 parent a59af9c commit 3e6a277
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lightningd/invoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1840,14 +1840,14 @@ static struct command_result *json_signinvoice(struct command *cmd,
char *b11enc = bolt11_encode(cmd, b11, have_n,
hsm_sign_b11, cmd->ld);

if (!b11->description)
/* BOLT #11:
* A writer:
* - MUST include either exactly one `d` or exactly one `h` field.
*/
if (!b11->description && !b11->description_hash)
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"Missing description in invoice");

if (!b11->expiry)
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"Missing expiry in invoice");

response = json_stream_success(cmd);
json_add_invstring(response, b11enc);
return command_success(cmd, response);
Expand Down

0 comments on commit 3e6a277

Please sign in to comment.