| 998 | } |
| 999 | |
| 1000 | static 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 | |
| 1018 | void offer_offer_id(const struct tlv_offer *offer, struct sha256 *id) |
| 1019 | { |
no test coverage detected