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

Function calc_offer

common/bolt12.c:1000–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998}
999
1000static void calc_offer(const u8 *tlvstream, struct sha256 *id)
1001{
1002 size_t start1, len1, start2, len2;
1003 struct sha256_ctx ctx;
1004
1005 /* BOLT #12:
1006 * A writer of an offer:
1007 * - MUST NOT set any TLV fields outside the inclusive ranges: 1 to 79 and 1000000000 to 1999999999.
1008 */
1009 len1 = tlv_span(tlvstream, 1, 79, &start1);
1010 len2 = tlv_span(tlvstream, 1000000000, 1999999999, &start2);
1011
1012 sha256_init(&ctx);
1013 sha256_update(&ctx, tlvstream + start1, len1);
1014 sha256_update(&ctx, tlvstream + start2, len2);
1015 sha256_done(&ctx, id);
1016}
1017
1018void offer_offer_id(const struct tlv_offer *offer, struct sha256 *id)
1019{

Callers 3

offer_offer_idFunction · 0.85
invreq_offer_idFunction · 0.85
invoice_offer_idFunction · 0.85

Calls 4

tlv_spanFunction · 0.85
sha256_initFunction · 0.85
sha256_updateFunction · 0.85
sha256_doneFunction · 0.85

Tested by

no test coverage detected