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

Function currency_done

plugins/offers_invreq_hook.c:755–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755static struct command_result *currency_done(struct command *cmd,
756 const char *method,
757 const char *buf,
758 const jsmntok_t *result,
759 struct invreq *ir)
760{
761 const jsmntok_t *msat = json_get_member(buf, result, "msat");
762 struct amount_msat amount;
763
764 /* Fail in this case, forwarding warnings. */
765 if (!msat)
766 return fail_internalerr(cmd, ir,
767 "Cannot convert currency %.*s: %.*s",
768 (int)tal_bytelen(ir->invreq->offer_currency),
769 (const char *)ir->invreq->offer_currency,
770 json_tok_full_len(result),
771 json_tok_full(buf, result));
772
773 if (!json_to_msat(buf, msat, &amount))
774 return fail_internalerr(cmd, ir,
775 "Bad convert for currency %.*s: %.*s",
776 (int)tal_bytelen(ir->invreq->offer_currency),
777 (const char *)ir->invreq->offer_currency,
778 json_tok_full_len(msat),
779 json_tok_full(buf, msat));
780
781 return handle_amount_and_recurrence(cmd, ir, amount);
782}
783
784static struct command_result *convert_currency(struct command *cmd,
785 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