MCPcopy Create free account
hub / github.com/ElementsProject/lightning / invreq_base_amount_simple

Function invreq_base_amount_simple

plugins/offers_invreq_hook.c:668–702  ·  view source on GitHub ↗

The non-currency-converting case. */

Source from the content-addressed store, hash-verified

666
667/* The non-currency-converting case. */
668static 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
704static struct command_result *handle_amount_and_recurrence(struct command *cmd,
705 struct invreq *ir,

Callers 1

listoffers_doneFunction · 0.85

Calls 2

amount_msatClass · 0.70

Tested by

no test coverage detected