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

Function waitblockheight_done

plugins/renepay/mods.c:756–805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754 */
755
756static 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
807static struct command_result *send_routes_cb(struct payment *payment)
808{

Callers

nothing calls this directly

Calls 12

route_sendpay_requestFunction · 0.85
payment_noteFunction · 0.85
route_deliversFunction · 0.85
route_feesFunction · 0.85
route_delayFunction · 0.85
fmt_route_pathFunction · 0.85
payment_continueFunction · 0.70
json_scanFunction · 0.50
plugin_errFunction · 0.50
plugin_logFunction · 0.50
aux_commandFunction · 0.50
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected