mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pay: Do not attempt to filter routehints if we can't find outselves
There are a couple of ways this can happen, but we shouldn't crash. Fixed #4488 Fixes #4533 Changelog-Fixed: pay: Fixed an issue when filtering routehints when we can't find ourselves in the local network view.
This commit is contained in:
committed by
Rusty Russell
parent
67c03c02a0
commit
eeba75ca7c
@@ -2332,8 +2332,16 @@ static struct route_info **filter_routehints(struct gossmap *map,
|
|||||||
{
|
{
|
||||||
const size_t max_hops = ROUTING_MAX_HOPS / 2;
|
const size_t max_hops = ROUTING_MAX_HOPS / 2;
|
||||||
char *mods = tal_strdup(tmpctx, "");
|
char *mods = tal_strdup(tmpctx, "");
|
||||||
for (size_t i = 0; i < tal_count(hints); i++) {
|
struct gossmap_node *src = gossmap_find_node(map, p->local_id);
|
||||||
struct gossmap_node *entrynode, *src;
|
|
||||||
|
if (src == NULL) {
|
||||||
|
tal_append_fmt(&mods,
|
||||||
|
"Could not locate ourselves in the gossip map, "
|
||||||
|
"leaving routehints untouched. ");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < tal_count(hints) && src != NULL; i++) {
|
||||||
|
struct gossmap_node *entrynode;
|
||||||
u32 distance;
|
u32 distance;
|
||||||
|
|
||||||
/* Trim any routehint > 10 hops */
|
/* Trim any routehint > 10 hops */
|
||||||
@@ -2365,8 +2373,6 @@ static struct route_info **filter_routehints(struct gossmap *map,
|
|||||||
/* If routehint entrypoint is unreachable there's no
|
/* If routehint entrypoint is unreachable there's no
|
||||||
* point in keeping it. */
|
* point in keeping it. */
|
||||||
entrynode = gossmap_find_node(map, &hints[i][0].pubkey);
|
entrynode = gossmap_find_node(map, &hints[i][0].pubkey);
|
||||||
src = gossmap_find_node(map, p->local_id);
|
|
||||||
|
|
||||||
if (entrynode == NULL) {
|
if (entrynode == NULL) {
|
||||||
tal_append_fmt(&mods,
|
tal_append_fmt(&mods,
|
||||||
"Removed routehint %zu because "
|
"Removed routehint %zu because "
|
||||||
|
|||||||
Reference in New Issue
Block a user