| 779 | } |
| 780 | |
| 781 | static 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 | |
| 810 | static struct command_result *convert_currency(struct command *cmd, |
| 811 | struct invreq *ir) |
nothing calls this directly
no test coverage detected