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

Function currency_done

plugins/offers_invreq_hook.c:781–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781static struct command_result *currency_done(struct command *cmd,
782 const char *method,
783 const char *buf,
784 const jsmntok_t *result,
785 struct invreq *ir)
786{
787 const jsmntok_t *msat = json_get_member(buf, result, "msat");
788 struct amount_msat amount;
789
790 /* Fail in this case, forwarding warnings. */
791 if (!msat)
792 return fail_internalerr(cmd, ir,
793 "Cannot convert currency %.*s: %.*s",
794 (int)tal_bytelen(ir->invreq->offer_currency),
795 (const char *)ir->invreq->offer_currency,
796 json_tok_full_len(result),
797 json_tok_full(buf, result));
798
799 if (!json_to_msat(buf, msat, &amount))
800 return fail_internalerr(cmd, ir,
801 "Bad convert for currency %.*s: %.*s",
802 (int)tal_bytelen(ir->invreq->offer_currency),
803 (const char *)ir->invreq->offer_currency,
804 json_tok_full_len(msat),
805 json_tok_full(buf, msat));
806
807 return handle_amount_and_recurrence(cmd, ir, amount);
808}
809
810static struct command_result *convert_currency(struct command *cmd,
811 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