| 773 | } |
| 774 | |
| 775 | static const char *check_bolt12_condition(const tal_t *ctx, |
| 776 | const struct rune_altern *alt, |
| 777 | const struct tlv_invoice *b12, |
| 778 | enum invoice_field invf) |
| 779 | { |
| 780 | |
| 781 | switch (invf) { |
| 782 | case INV_FIELD_AMOUNT: |
| 783 | if (!b12->invoice_amount) |
| 784 | return rune_alt_single_missing(ctx, alt); |
| 785 | return rune_alt_single_int(ctx, alt, *b12->invoice_amount); |
| 786 | case INV_FIELD_NODE_ID: { |
| 787 | if (!b12->offer_issuer_id) |
| 788 | return rune_alt_single_missing(ctx, alt); |
| 789 | const char *id = fmt_pubkey(tmpctx, b12->offer_issuer_id); |
| 790 | return rune_alt_single_str(ctx, alt, id, strlen(id)); |
| 791 | } |
| 792 | case INV_FIELD_DESCRIPTION: |
| 793 | if (!b12->offer_description) |
| 794 | return rune_alt_single_missing(ctx, alt); |
| 795 | return rune_alt_single_str(ctx, alt, b12->offer_description, |
| 796 | tal_bytelen(b12->offer_description)); |
| 797 | } |
| 798 | abort(); |
| 799 | } |
| 800 | |
| 801 | static const char *check_inv_condition(const tal_t *ctx, |
| 802 | const struct rune_altern *alt, |
no test coverage detected