| 754 | */ |
| 755 | |
| 756 | static struct command_result *waitblockheight_done(struct command *cmd, |
| 757 | const char *method UNUSED, |
| 758 | const char *buf, |
| 759 | const jsmntok_t *result, |
| 760 | struct payment *payment) |
| 761 | { |
| 762 | const char *err; |
| 763 | struct command *aux_cmd; |
| 764 | struct route *route; |
| 765 | struct routetracker *routetracker; |
| 766 | |
| 767 | err = json_scan(tmpctx, buf, result, "{blockheight:%}", |
| 768 | JSON_SCAN(json_to_u32, &payment->blockheight)); |
| 769 | payment->blockheight += 1; |
| 770 | |
| 771 | if (err) { |
| 772 | plugin_err(pay_plugin->plugin, |
| 773 | "Failed to read blockheight from waitblockheight " |
| 774 | "response: %s", |
| 775 | err); |
| 776 | return payment_continue(payment); |
| 777 | } |
| 778 | |
| 779 | routetracker = payment->routetracker; |
| 780 | assert(routetracker); |
| 781 | if (!routetracker->computed_routes || |
| 782 | tal_count(routetracker->computed_routes) == 0) { |
| 783 | plugin_log(pay_plugin->plugin, LOG_UNUSUAL, |
| 784 | "%s: there are no routes to send, skipping.", |
| 785 | __func__); |
| 786 | return payment_continue(payment); |
| 787 | } |
| 788 | for (size_t i = 0; i < tal_count(routetracker->computed_routes); i++) { |
| 789 | aux_cmd = aux_command(cmd); |
| 790 | route = routetracker->computed_routes[i]; |
| 791 | |
| 792 | route_sendpay_request(aux_cmd, take(route), payment); |
| 793 | |
| 794 | payment_note(payment, LOG_INFORM, |
| 795 | "Sent route request: partid=%" PRIu64 |
| 796 | " amount=%s prob=%.3lf fees=%s delay=%u path=%s", |
| 797 | route->key.partid, |
| 798 | fmt_amount_msat(tmpctx, route_delivers(route)), |
| 799 | route->success_prob, |
| 800 | fmt_amount_msat(tmpctx, route_fees(route)), |
| 801 | route_delay(route), fmt_route_path(tmpctx, route)); |
| 802 | } |
| 803 | tal_resize(&routetracker->computed_routes, 0); |
| 804 | return payment_continue(payment); |
| 805 | } |
| 806 | |
| 807 | static struct command_result *send_routes_cb(struct payment *payment) |
| 808 | { |
nothing calls this directly
no test coverage detected