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

Function invreq_base_amount_simple

plugins/offers_invreq_hook.c:681–715  ·  view source on GitHub ↗

The non-currency-converting case. */

Source from the content-addressed store, hash-verified

679
680/* The non-currency-converting case. */
681static 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
717static struct command_result *handle_amount_and_recurrence(struct command *cmd,
718 struct invreq *ir,

Callers 1

listoffers_doneFunction · 0.85

Calls 2

amount_msatClass · 0.70

Tested by

no test coverage detected