mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
routing: Returning channel_id to getroute requests
The new onion uses the `channel_id` instead of the `node_id` of the next hop to identify where to forward the payment. So we return the exact channel chosen by the routing algo, to avoid having to look it up again later.
This commit is contained in:
@@ -911,6 +911,7 @@ struct route_hop *get_route(tal_t *ctx, struct routing_state *rstate,
|
||||
total_delay = 0;
|
||||
|
||||
for (i = tal_count(route) - 1; i >= 0; i--) {
|
||||
hops[i + 1].channel_id = route[i]->short_channel_id;
|
||||
hops[i + 1].nodeid = route[i]->dst->id;
|
||||
hops[i + 1].amount = total_amount;
|
||||
total_amount += connection_fee(route[i], total_amount);
|
||||
@@ -921,6 +922,7 @@ struct route_hop *get_route(tal_t *ctx, struct routing_state *rstate,
|
||||
hops[i + 1].delay = total_delay;
|
||||
}
|
||||
/* Backfill the first hop manually */
|
||||
hops[0].channel_id = first_conn->short_channel_id;
|
||||
hops[0].nodeid = first_conn->dst->id;
|
||||
/* We don't charge ourselves any fees. */
|
||||
hops[0].amount = total_amount;
|
||||
|
||||
Reference in New Issue
Block a user