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:
Christian Decker
2017-04-29 10:52:40 +02:00
parent f24aab1916
commit d87ca4121d
6 changed files with 22 additions and 1 deletions

View File

@@ -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;