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

Function decode_c

common/bolt11.c:266–287  ·  view source on GitHub ↗

BOLT #11: * * `c` (24): `data_length` variable. `min_final_cltv_expiry` to use for the * last HTLC in the route. Default is 18 if not specified. */

Source from the content-addressed store, hash-verified

264 * last HTLC in the route. Default is 18 if not specified.
265 */
266static char *decode_c(struct bolt11 *b11,
267 struct hash_u5 *hu5,
268 u5 **data, size_t *data_len,
269 size_t data_length, bool *have_c)
270{
271 u64 c;
272 if (*have_c)
273 return unknown_field(b11, hu5, data, data_len, 'c',
274 data_length);
275
276 /* FIXME: Put upper limit in bolt 11 */
277 if (!pull_uint(hu5, data, data_len, &c, data_length * 5))
278 return tal_fmt(b11, "c: length %zu chars is excessive",
279 *data_len);
280 b11->min_final_cltv_expiry = c;
281 /* Can overflow, since c is 64 bits but value must be < 32 bits */
282 if (b11->min_final_cltv_expiry != c)
283 return tal_fmt(b11, "c: %"PRIu64" is too large", c);
284
285 *have_c = true;
286 return NULL;
287}
288
289static char *decode_n(struct bolt11 *b11,
290 struct hash_u5 *hu5,

Callers 1

bolt11_decode_nosigFunction · 0.85

Calls 2

unknown_fieldFunction · 0.85
pull_uintFunction · 0.85

Tested by

no test coverage detected