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

Function invreq_base_amount_simple

plugins/offers_invreq_hook.c:694–728  ·  view source on GitHub ↗

The non-currency-converting case. */

Source from the content-addressed store, hash-verified

692
693/* The non-currency-converting case. */
694static struct command_result *invreq_base_amount_simple(struct command *cmd,
695 const struct invreq *ir,
696 struct amount_msat *amt)
697{
698 struct command_result *err;
699
700 if (ir->invreq->offer_amount) {
701 u64 raw_amount;
702 assert(!ir->invreq->offer_currency);
703 err = invreq_amount_by_quantity(cmd, ir, &raw_amount);
704 if (err)
705 return err;
706
707 *amt = amount_msat(raw_amount);
708 } else {
709 /* BOLT-recurrence #12:
710 *
711 * The reader:
712 *...
713 * - otherwise (no `offer_amount`):
714 * - MUST reject the invoice request if `invreq_recurrence_cancel`
715 * is not present and it does not contain `invreq_amount`.
716 */
717 if (!ir->invreq->invreq_recurrence_cancel) {
718 err = invreq_must_have(cmd, ir, invreq_amount);
719 if (err)
720 return err;
721 }
722 if (ir->invreq->invreq_amount)
723 *amt = amount_msat(*ir->invreq->invreq_amount);
724 else
725 *amt = AMOUNT_MSAT(0);
726 }
727 return NULL;
728}
729
730static struct command_result *handle_amount_and_recurrence(struct command *cmd,
731 struct invreq *ir,

Callers 1

listoffers_doneFunction · 0.85

Calls 2

amount_msatClass · 0.70

Tested by

no test coverage detected