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

Function currency_done

plugins/offers_invreq_hook.c:559–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559static struct command_result *currency_done(struct command *cmd,
560 const char *buf,
561 const jsmntok_t *result,
562 struct invreq *ir)
563{
564 const jsmntok_t *msat = json_get_member(buf, result, "msat");
565 struct amount_msat amount;
566
567 /* Fail in this case, forwarding warnings. */
568 if (!msat)
569 return fail_internalerr(cmd, ir,
570 "Cannot convert currency %.*s: %.*s",
571 (int)tal_bytelen(ir->offer->currency),
572 (const char *)ir->offer->currency,
573 json_tok_full_len(result),
574 json_tok_full(buf, result));
575
576 if (!json_to_msat(buf, msat, &amount))
577 return fail_internalerr(cmd, ir,
578 "Bad convert for currency %.*s: %.*s",
579 (int)tal_bytelen(ir->offer->currency),
580 (const char *)ir->offer->currency,
581 json_tok_full_len(msat),
582 json_tok_full(buf, msat));
583
584 return handle_amount_and_recurrence(cmd, ir, amount);
585}
586
587static struct command_result *convert_currency(struct command *cmd,
588 struct invreq *ir)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected