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

Function currency_done

plugins/offers_invreq_hook.c:768–795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

766}
767
768static struct command_result *currency_done(struct command *cmd,
769 const char *method,
770 const char *buf,
771 const jsmntok_t *result,
772 struct invreq *ir)
773{
774 const jsmntok_t *msat = json_get_member(buf, result, "msat");
775 struct amount_msat amount;
776
777 /* Fail in this case, forwarding warnings. */
778 if (!msat)
779 return fail_internalerr(cmd, ir,
780 "Cannot convert currency %.*s: %.*s",
781 (int)tal_bytelen(ir->invreq->offer_currency),
782 (const char *)ir->invreq->offer_currency,
783 json_tok_full_len(result),
784 json_tok_full(buf, result));
785
786 if (!json_to_msat(buf, msat, &amount))
787 return fail_internalerr(cmd, ir,
788 "Bad convert for currency %.*s: %.*s",
789 (int)tal_bytelen(ir->invreq->offer_currency),
790 (const char *)ir->invreq->offer_currency,
791 json_tok_full_len(msat),
792 json_tok_full(buf, msat));
793
794 return handle_amount_and_recurrence(cmd, ir, amount);
795}
796
797static struct command_result *convert_currency(struct command *cmd,
798 struct invreq *ir)

Callers

nothing calls this directly

Calls 7

json_get_memberFunction · 0.85
tal_bytelenFunction · 0.85
fail_internalerrFunction · 0.70
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
json_to_msatFunction · 0.50

Tested by

no test coverage detected