From 4998e7027cb7c991f431b548b0bebc0053a90358 Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Mon, 6 Feb 2023 12:28:56 +1030 Subject: [PATCH] doc: Correct `createinvoice`'s `invstring` description The existing description is incorrect. `createinvoice` doesn't actually work when supplied with a custom-encoded bolt11 invoice without the final 520 signature bits appended. If a users tries to do so, some of their tagged fields will be incorrectly truncated. `createinvoice` actually expects that the signatures are there, and it simply ignores them. See common/bolt11.c's bolt11_decode_nosig: /* BOLT #11: * * The data part of a Lightning invoice consists of multiple sections: * * 1. `timestamp`: seconds-since-1970 (35 bits, big-endian) * 1. zero or more tagged parts * 1. `signature`: Bitcoin-style signature of above (520 bits) */ if (!pull_uint(&hu5, &data, &data_len, &b11->timestamp, 35)) return decode_fail(b11, fail, "Can't get 35-bit timestamp"); > while (data_len > 520 / 5) { const char *problem = NULL; u64 type, data_length; --- doc/lightning-createinvoice.7.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lightning-createinvoice.7.md b/doc/lightning-createinvoice.7.md index f841a7f95775..0d62d70afe6f 100644 --- a/doc/lightning-createinvoice.7.md +++ b/doc/lightning-createinvoice.7.md @@ -12,8 +12,8 @@ DESCRIPTION The **createinvoice** RPC command signs and saves an invoice into the database. -The *invstring* parameter is of bolt11 form, but without the final -signature appended. Minimal sanity checks are done. (Note: if +The *invstring* parameter is of bolt11 form, but the final signature +is ignored. Minimal sanity checks are done. (Note: if **experimental-offers** is enabled, *invstring* can actually be an unsigned bolt12 invoice).