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

Function invreq_base_amount_simple

plugins/offers_invreq_hook.c:470–500  ·  view source on GitHub ↗

The non-currency-converting case. */

Source from the content-addressed store, hash-verified

468
469/* The non-currency-converting case. */
470static 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
502static struct command_result *handle_amount_and_recurrence(struct command *cmd,
503 struct invreq *ir,

Callers 1

listoffers_doneFunction · 0.85

Calls 2

amount_msatClass · 0.70

Tested by

no test coverage detected