From 4dd7a2fbba7c61153907cbd75e8751a3e5561c5c Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 17 Jun 2021 17:01:39 +0200 Subject: [PATCH] pay: Fix another instance of a crash when we can't find ourselves --- plugins/libplugin-pay.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index f0091e2f28fd..f044cccf5f89 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -2633,7 +2633,7 @@ static void routehint_check_reachable(struct payment *p) dst = gossmap_find_node(gossmap, p->destination); if (dst == NULL) d->destination_reachable = false; - else { + else if (src != NULL) { dij = dijkstra(tmpctx, gossmap, dst, AMOUNT_MSAT(1000), 10 / 1000000.0, payment_route_can_carry_even_disabled, @@ -2644,6 +2644,11 @@ static void routehint_check_reachable(struct payment *p) /* If there was a route the destination is reachable * without routehints. */ d->destination_reachable = r != NULL; + } else { + paymod_log(p, LOG_DBG, + "Could not locate ourselves in the network. " + "Allowing direct attempts"); + d->destination_reachable = true; } if (d->destination_reachable) {