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

Function decode_p

common/bolt11.c:173–193  ·  view source on GitHub ↗

BOLT #11: * * `p` (1): `data_length` 52. 256-bit SHA256 payment_hash. Preimage of this * provides proof of payment */

Source from the content-addressed store, hash-verified

171 * provides proof of payment
172 */
173static const char *decode_p(struct bolt11 *b11,
174 const struct feature_set *our_features,
175 struct hash_u5 *hu5,
176 const u5 **data, size_t *field_len,
177 bool *have_p)
178{
179 /* BOLT #11:
180 *
181 * A payer... SHOULD use the first `p` field as the payment hash.
182 */
183 assert(!*have_p);
184
185 /* BOLT #11:
186 *
187 * A reader...
188 * - MUST fail the payment if any field with fixed `data_length` (`p`, `h`, `s`, `n`)
189 * does not have the correct length (52, 52, 52, 53).
190 */
191 return pull_expected_length(b11, hu5, data, field_len, 52, 'p',
192 have_p, &b11->payment_hash);
193}
194
195/* BOLT #11:
196 *

Callers

nothing calls this directly

Calls 1

pull_expected_lengthFunction · 0.85

Tested by

no test coverage detected