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

Function route_failure_register

plugins/renepay/routetracker.c:97–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 routetracker_add_to_final(routetracker, route);
96}
97void route_failure_register(struct routetracker *routetracker,
98 struct route *route)
99{
100 struct payment_result *result = route->result;
101 assert(result);
102
103 /* Update the knowledge in the uncertaity network. */
104 if (route->hops && result->failcode) {
105 assert(result->erring_index);
106 int path_len = tal_count(route->hops);
107
108 /* index of the last channel before the erring node */
109 const int last_good_channel = *result->erring_index - 1;
110
111 if (last_good_channel >= path_len) {
112 plugin_err(pay_plugin->plugin,
113 "last_good_channel (%d) >= path_len (%d)",
114 last_good_channel, path_len);
115 }
116
117 /* All channels before the erring node could forward the
118 * payment. */
119 for (int i = 0; i <= last_good_channel; i++) {
120 uncertainty_channel_can_send(pay_plugin->uncertainty,
121 route->hops[i].scid,
122 route->hops[i].direction);
123 }
124
125 if (*result->failcode == WIRE_TEMPORARY_CHANNEL_FAILURE &&
126 (last_good_channel + 1) < path_len) {
127 /* A WIRE_TEMPORARY_CHANNEL_FAILURE could mean not
128 * enough liquidity to forward the payment or cannot add
129 * one more HTLC.
130 */
131 uncertainty_channel_cannot_send(
132 pay_plugin->uncertainty,
133 route->hops[last_good_channel + 1].scid,
134 route->hops[last_good_channel + 1].direction);
135 }
136 }
137 routetracker_add_to_final(routetracker, route);
138}
139
140static void remove_route(struct route *route, struct route_map *map)
141{

Callers 1

routefail_endFunction · 0.85

Calls 4

plugin_errFunction · 0.50

Tested by

no test coverage detected