| 695 | } |
| 696 | |
| 697 | static void calc_offer(const u8 *tlvstream, struct sha256 *id) |
| 698 | { |
| 699 | size_t start1, len1, start2, len2; |
| 700 | struct sha256_ctx ctx; |
| 701 | |
| 702 | /* BOLT #12: |
| 703 | * A writer of an offer: |
| 704 | * - MUST NOT set any TLV fields outside the inclusive ranges: 1 to 79 and 1000000000 to 1999999999. |
| 705 | */ |
| 706 | len1 = tlv_span(tlvstream, 1, 79, &start1); |
| 707 | len2 = tlv_span(tlvstream, 1000000000, 1999999999, &start2); |
| 708 | |
| 709 | sha256_init(&ctx); |
| 710 | sha256_update(&ctx, tlvstream + start1, len1); |
| 711 | sha256_update(&ctx, tlvstream + start2, len2); |
| 712 | sha256_done(&ctx, id); |
| 713 | } |
| 714 | |
| 715 | void offer_offer_id(const struct tlv_offer *offer, struct sha256 *id) |
| 716 | { |
no test coverage detected