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

Function encode_extra

common/bolt11.c:1104–1120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102}
1103
1104static bool encode_extra(u5 **data, const struct bolt11_field *extra)
1105{
1106 size_t len;
1107
1108 /* Can't encode an invalid tag. */
1109 if (bech32_charset_rev[(unsigned char)extra->tag] == -1)
1110 return false;
1111
1112 push_varlen_uint(data, bech32_charset_rev[(unsigned char)extra->tag], 5);
1113 push_varlen_uint(data, tal_count(extra->data), 10);
1114
1115 /* extra->data is already u5s, so do this raw. */
1116 len = tal_count(*data);
1117 tal_resize(data, len + tal_count(extra->data));
1118 memcpy(*data + len, extra->data, tal_count(extra->data));
1119 return true;
1120}
1121
1122/* Encodes, even if it's nonsense. */
1123char *bolt11_encode_(const tal_t *ctx,

Callers 1

bolt11_encode_Function · 0.85

Calls 1

push_varlen_uintFunction · 0.85

Tested by

no test coverage detected