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

Function decode_h

common/bolt11.c:211–235  ·  view source on GitHub ↗

BOLT #11: * * `h` (23): `data_length` 52. 256-bit description of purpose of payment * (SHA256). This is used to commit to an associated description that is over * 639 bytes, but the transport mechanism for the description in that case is * transport specific and not defined here. */

Source from the content-addressed store, hash-verified

209 * transport specific and not defined here.
210 */
211static void decode_h(struct bolt11 *b11,
212 struct hash_u5 *hu5,
213 u5 **data, size_t *data_len,
214 size_t data_length, bool *have_h)
215{
216 if (*have_h) {
217 unknown_field(b11, hu5, data, data_len, 'h', data_length);
218 return;
219 }
220
221 /* BOLT #11:
222 *
223 * A reader... MUST skip over unknown fields, OR an `f` field
224 * with unknown `version`, OR `p`, `h`, `s` or `n` fields that do
225 * NOT have `data_length`s of 52, 52, 52 or 53, respectively. */
226 if (data_length != 52) {
227 unknown_field(b11, hu5, data, data_len, 'h', data_length);
228 return;
229 }
230
231 b11->description_hash = tal(b11, struct sha256);
232 pull_bits_certain(hu5, data, data_len, b11->description_hash, 256,
233 false);
234 *have_h = true;
235}
236
237/* BOLT #11:
238 *

Callers 1

bolt11_decode_nosigFunction · 0.85

Calls 1

unknown_fieldFunction · 0.85

Tested by

no test coverage detected