The non-currency-converting case. */
| 468 | |
| 469 | /* The non-currency-converting case. */ |
| 470 | static struct command_result *invreq_base_amount_simple(struct command *cmd, |
| 471 | const struct invreq *ir, |
| 472 | struct amount_msat *amt) |
| 473 | { |
| 474 | struct command_result *err; |
| 475 | |
| 476 | if (ir->offer->amount) { |
| 477 | u64 raw_amount; |
| 478 | assert(!ir->offer->currency); |
| 479 | err = invreq_amount_by_quantity(cmd, ir, &raw_amount); |
| 480 | if (err) |
| 481 | return err; |
| 482 | |
| 483 | *amt = amount_msat(raw_amount); |
| 484 | } else { |
| 485 | /* BOLT-offers-recurrence #12: |
| 486 | * |
| 487 | * - otherwise: |
| 488 | * - MUST fail the request if it does not contain `amount`. |
| 489 | * - MUST use the request `amount` as the *base invoice amount*. |
| 490 | * (Note: invoice amount can be further modified by recurrence |
| 491 | * below) |
| 492 | */ |
| 493 | err = invreq_must_have(cmd, ir, amount); |
| 494 | if (err) |
| 495 | return err; |
| 496 | |
| 497 | *amt = amount_msat(*ir->invreq->amount); |
| 498 | } |
| 499 | return NULL; |
| 500 | } |
| 501 | |
| 502 | static struct command_result *handle_amount_and_recurrence(struct command *cmd, |
| 503 | struct invreq *ir, |
no test coverage detected