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

Function route_pending_register

plugins/renepay/routetracker.c:151–187  ·  view source on GitHub ↗

This route is pending, ie. locked in HTLCs. * Called either: * - after a sendpay is accepted, * - or after listsendpays reveals some pending route that we didn't * previously know about. */

Source from the content-addressed store, hash-verified

149 * - or after listsendpays reveals some pending route that we didn't
150 * previously know about. */
151static void route_pending_register(struct routetracker *routetracker,
152 struct route *route TAKES)
153{
154 assert(route);
155 assert(routetracker);
156 struct payment *payment = route_get_payment_verify(route);
157 assert(payment);
158 assert(payment->groupid == route->key.groupid);
159
160 /* we already keep track of this route */
161 if (route_map_get(pay_plugin->pending_routes, &route->key))
162 plugin_err(pay_plugin->plugin,
163 "%s: tracking a route (%s) duplicate?",
164 __func__,
165 fmt_routekey(tmpctx, &route->key));
166
167 uncertainty_commit_htlcs(pay_plugin->uncertainty, route);
168
169 if (taken(route))
170 tal_steal(pay_plugin->pending_routes, route);
171
172 if (!route_map_add(pay_plugin->pending_routes, route) ||
173 !tal_add_destructor2(route, remove_route,
174 pay_plugin->pending_routes))
175 plugin_err(pay_plugin->plugin, "%s: failed to register route.",
176 __func__);
177
178 if (!amount_msat_add(&payment->total_sent, payment->total_sent,
179 route_sends(route)) ||
180 !amount_msat_add(&payment->total_delivering,
181 payment->total_delivering,
182 route_delivers(route))) {
183 plugin_err(pay_plugin->plugin,
184 "%s: amount_msat arithmetic overflow.",
185 __func__);
186 }
187}
188
189void payment_collect_results(struct payment *payment,
190 struct preimage **payment_preimage,

Callers 1

route_sendpay_requestFunction · 0.85

Calls 8

route_get_payment_verifyFunction · 0.85
fmt_routekeyFunction · 0.85
uncertainty_commit_htlcsFunction · 0.85
takenFunction · 0.85
amount_msat_addFunction · 0.85
route_sendsFunction · 0.85
route_deliversFunction · 0.85
plugin_errFunction · 0.50

Tested by

no test coverage detected