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;
This commit is contained in:
Carl Dong 2022-11-07 12:20:19 -05:00 committed by Alex Myers
parent 8369ca71b1
commit f0b8544eba

View File

@ -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).