| 557 | } |
| 558 | |
| 559 | static 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 | |
| 587 | static struct command_result *convert_currency(struct command *cmd, |
| 588 | struct invreq *ir) |
nothing calls this directly
no test coverage detected