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

Function decode_s

common/bolt11.c:322–346  ·  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

320 * forwarding nodes from probing the payment recipient.
321 */
322static char *decode_s(struct bolt11 *b11,
323 struct hash_u5 *hu5,
324 u5 **data, size_t *data_len,
325 size_t data_length,
326 bool *have_s)
327{
328 if (*have_s)
329 return unknown_field(b11, hu5, data, data_len, 's',
330 data_length);
331
332 /* BOLT #11:
333 *
334 * A reader... MUST skip over unknown fields, OR an `f` field
335 * with unknown `version`, OR `p`, `h`, `s` or `n` fields that do
336 * NOT have `data_length`s of 52, 52, 52 or 53, respectively. */
337 if (data_length != 52)
338 return unknown_field(b11, hu5, data, data_len, 's',
339 data_length);
340
341 b11->payment_secret = tal(b11, struct secret);
342 pull_bits_certain(hu5, data, data_len, b11->payment_secret, 256,
343 false);
344 *have_s = true;
345 return NULL;
346}
347
348/* BOLT #11:
349 *

Callers 1

bolt11_decode_nosigFunction · 0.85

Calls 1

unknown_fieldFunction · 0.85

Tested by

no test coverage detected