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

Function decode_n

common/bolt11.c:315–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315static const char *decode_n(struct bolt11 *b11,
316 const struct feature_set *our_features,
317 struct hash_u5 *hu5,
318 const u5 **data, size_t *field_len,
319 bool *have_n)
320{
321 const char *err;
322
323 assert(!*have_n);
324 /* BOLT #11:
325 *
326 * A reader...
327 * - MUST fail the payment if any field with fixed `data_length` (`p`, `h`, `s`, `n`)
328 * does not have the correct length (52, 52, 52, 53). */
329 err = pull_expected_length(b11, hu5, data, field_len, 53, 'n', have_n,
330 &b11->receiver_id.k);
331
332 /* If that gave us a node ID, check it. */
333 if (*have_n) {
334 struct pubkey k;
335 if (!pubkey_from_node_id(&k, &b11->receiver_id))
336 return tal_fmt(
337 b11, "invalid public key %s",
338 fmt_node_id(tmpctx, &b11->receiver_id));
339 }
340
341 return err;
342}
343
344/* BOLT #11:
345 *

Callers

nothing calls this directly

Calls 3

pull_expected_lengthFunction · 0.85
fmt_node_idFunction · 0.85
pubkey_from_node_idFunction · 0.70

Tested by

no test coverage detected