MCPcopy Create free account
hub / github.com/ElementsProject/lightning / decode_m

Function decode_m

common/bolt11.c:545–563  ·  view source on GitHub ↗

BOLT #11: * * `m` (27): `data_length` variable. Additional metadata to attach to * the payment. Note that the size of this field is limited by the * maximum hop payload size. Long metadata fields reduce the maximum * route length. */

Source from the content-addressed store, hash-verified

543 * route length.
544 */
545static char *decode_m(struct bolt11 *b11,
546 struct hash_u5 *hu5,
547 u5 **data, size_t *data_len,
548 size_t data_length,
549 bool *have_m)
550{
551 size_t mlen = (data_length * 5) / 8;
552
553 if (*have_m)
554 return unknown_field(b11, hu5, data, data_len, 'm',
555 data_length);
556
557 b11->metadata = tal_arr(b11, u8, mlen);
558 pull_bits_certain(hu5, data, data_len, b11->metadata,
559 data_length * 5, false);
560
561 *have_m = true;
562 return NULL;
563}
564
565struct bolt11 *new_bolt11(const tal_t *ctx,
566 const struct amount_msat *msat TAKES)

Callers 1

bolt11_decode_nosigFunction · 0.85

Calls 1

unknown_fieldFunction · 0.85

Tested by

no test coverage detected