Skip to content

Commit e9f9721

Browse files
rustyrussellcdecker
authored andcommitted
devtools/bolt11-cli: handle hashed descriptions
Signed-off-by: Rusty Russell <[email protected]>
1 parent 34444a9 commit e9f9721

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

devtools/bolt11-cli.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
5959
struct bolt11 *b11;
6060
struct bolt11_field *extra;
6161
size_t i;
62-
char *fail;
62+
char *fail, *description = NULL;
6363

6464
err_set_progname(argv[0]);
6565
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
@@ -68,6 +68,9 @@ int main(int argc, char *argv[])
6868
opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn);
6969
opt_register_noarg("--help|-h", opt_usage_and_exit,
7070
"<decode> <bolt11>", "Show this message");
71+
opt_register_arg("--hashed-description", opt_set_charp, opt_show_charp,
72+
&description,
73+
"Description to check hashed description against");
7174
opt_register_version();
7275

7376
opt_early_parse(argc, argv, opt_log_stderr_exit);
@@ -86,7 +89,7 @@ int main(int argc, char *argv[])
8689
errx(ERROR_USAGE, "Need argument\n%s",
8790
opt_usage(argv[0], NULL));
8891

89-
b11 = bolt11_decode(ctx, argv[2], NULL, &fail);
92+
b11 = bolt11_decode(ctx, argv[2], description, &fail);
9093
if (!b11)
9194
errx(ERROR_BAD_DECODE, "%s", fail);
9295

@@ -105,7 +108,7 @@ int main(int argc, char *argv[])
105108
printf("description: %s\n", b11->description);
106109
if (b11->description_hash)
107110
printf("description_hash: %s\n",
108-
tal_hexstr(ctx, b11->description,
111+
tal_hexstr(ctx, b11->description_hash,
109112
sizeof(*b11->description_hash)));
110113

111114
if (tal_len(b11->fallback)) {

0 commit comments

Comments
 (0)