The non-currency-converting case. */
| 679 | |
| 680 | /* The non-currency-converting case. */ |
| 681 | static struct command_result *invreq_base_amount_simple(struct command *cmd, |
| 682 | const struct invreq *ir, |
| 683 | struct amount_msat *amt) |
| 684 | { |
| 685 | struct command_result *err; |
| 686 | |
| 687 | if (ir->invreq->offer_amount) { |
| 688 | u64 raw_amount; |
| 689 | assert(!ir->invreq->offer_currency); |
| 690 | err = invreq_amount_by_quantity(cmd, ir, &raw_amount); |
| 691 | if (err) |
| 692 | return err; |
| 693 | |
| 694 | *amt = amount_msat(raw_amount); |
| 695 | } else { |
| 696 | /* BOLT-recurrence #12: |
| 697 | * |
| 698 | * The reader: |
| 699 | *... |
| 700 | * - otherwise (no `offer_amount`): |
| 701 | * - MUST reject the invoice request if `invreq_recurrence_cancel` |
| 702 | * is not present and it does not contain `invreq_amount`. |
| 703 | */ |
| 704 | if (!ir->invreq->invreq_recurrence_cancel) { |
| 705 | err = invreq_must_have(cmd, ir, invreq_amount); |
| 706 | if (err) |
| 707 | return err; |
| 708 | } |
| 709 | if (ir->invreq->invreq_amount) |
| 710 | *amt = amount_msat(*ir->invreq->invreq_amount); |
| 711 | else |
| 712 | *amt = AMOUNT_MSAT(0); |
| 713 | } |
| 714 | return NULL; |
| 715 | } |
| 716 | |
| 717 | static struct command_result *handle_amount_and_recurrence(struct command *cmd, |
| 718 | struct invreq *ir, |
no test coverage detected