| 753 | } |
| 754 | |
| 755 | static 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 | |
| 784 | static struct command_result *convert_currency(struct command *cmd, |
| 785 | struct invreq *ir) |
nothing calls this directly
no test coverage detected