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

Function decode_s

common/bolt11.c:349–370  ·  view source on GitHub ↗

BOLT #11: * * * `s` (16): `data_length` 52. This 256-bit secret prevents * forwarding nodes from probing the payment recipient. */

Source from the content-addressed store, hash-verified

347 * forwarding nodes from probing the payment recipient.
348 */
349static const char *decode_s(struct bolt11 *b11,
350 const struct feature_set *our_features,
351 struct hash_u5 *hu5,
352 const u5 **data, size_t *field_len,
353 bool *have_s)
354{
355 const char *err;
356 struct secret secret;
357
358 assert(!*have_s);
359
360 /* BOLT #11:
361 *
362 * A reader...
363 * - MUST fail the payment if any field with fixed `data_length` (`p`, `h`, `s`, `n`)
364 * does not have the correct length (52, 52, 52, 53). */
365 err = pull_expected_length(b11, hu5, data, field_len, 52, 's',
366 have_s, &secret);
367 if (*have_s)
368 b11->payment_secret = tal_dup(b11, struct secret, &secret);
369 return err;
370}
371
372/* BOLT #11:
373 *

Callers

nothing calls this directly

Calls 1

pull_expected_lengthFunction · 0.85

Tested by

no test coverage detected