From 754616c45a7bd7e1f9d449d711992355bec34fe7 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 26 Aug 2016 15:39:35 +0930 Subject: [PATCH] routing: Fix for single hop routes segfaulting. The first hop is being stripped from computed routes, however the first channel of the route is being used to get our peer address. This results in segfaults if the route is just one hop, i.e., has no first channel to get the peer's address from. Fixed by simply using an existing pointer to our peer. --- daemon/routing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/routing.c b/daemon/routing.c index ecbe95d15..ca946b136 100644 --- a/daemon/routing.c +++ b/daemon/routing.c @@ -278,7 +278,7 @@ struct peer *find_route(struct lightningd_state *dstate, assert(n == src); /* We should only add routes if we have a peer. */ - first = find_peer(dstate, &(*route)[0]->src->id); + first = find_peer(dstate, &dst->id); if (!first) { log_broken_struct(dstate->base_log, "No peer %s?", struct pubkey, &(*route)[0]->src->id);