The non-currency-converting case. */
| 666 | |
| 667 | /* The non-currency-converting case. */ |
| 668 | static struct command_result *invreq_base_amount_simple(struct command *cmd, |
| 669 | const struct invreq *ir, |
| 670 | struct amount_msat *amt) |
| 671 | { |
| 672 | struct command_result *err; |
| 673 | |
| 674 | if (ir->invreq->offer_amount) { |
| 675 | u64 raw_amount; |
| 676 | assert(!ir->invreq->offer_currency); |
| 677 | err = invreq_amount_by_quantity(cmd, ir, &raw_amount); |
| 678 | if (err) |
| 679 | return err; |
| 680 | |
| 681 | *amt = amount_msat(raw_amount); |
| 682 | } else { |
| 683 | /* BOLT-recurrence #12: |
| 684 | * |
| 685 | * The reader: |
| 686 | *... |
| 687 | * - otherwise (no `offer_amount`): |
| 688 | * - MUST reject the invoice request if `invreq_recurrence_cancel` |
| 689 | * is not present and it does not contain `invreq_amount`. |
| 690 | */ |
| 691 | if (!ir->invreq->invreq_recurrence_cancel) { |
| 692 | err = invreq_must_have(cmd, ir, invreq_amount); |
| 693 | if (err) |
| 694 | return err; |
| 695 | } |
| 696 | if (ir->invreq->invreq_amount) |
| 697 | *amt = amount_msat(*ir->invreq->invreq_amount); |
| 698 | else |
| 699 | *amt = AMOUNT_MSAT(0); |
| 700 | } |
| 701 | return NULL; |
| 702 | } |
| 703 | |
| 704 | static struct command_result *handle_amount_and_recurrence(struct command *cmd, |
| 705 | struct invreq *ir, |
no test coverage detected