From 8ce3b86aa571ce7d1e7ceacb8951ec6f63102239 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 20 Jun 2019 12:26:52 +0930 Subject: [PATCH] gossipd: tighter correctness checks during gossip_store load. We shouldn't be loading old timestamps, either. Signed-off-by: Rusty Russell --- gossipd/routing.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 316268c27..4d433acd5 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -2163,8 +2163,8 @@ bool routing_add_node_announcement(struct routing_state *rstate, &node_id)); return false; } else if (timestamp <= pna->timestamp) - /* Ignore old ones: they're OK though. */ - return true; + /* Ignore old ones: they're OK (unless from store). */ + return index == 0; SUPERVERBOSE("Deferring node_announcement for node %s", type_to_string(tmpctx, struct node_id, &node_id)); @@ -2184,7 +2184,8 @@ bool routing_add_node_announcement(struct routing_state *rstate, } if (node->bcast.index && node->bcast.timestamp >= timestamp) { SUPERVERBOSE("Ignoring node announcement, it's outdated."); - return true; + /* OK unless we're loading from store */ + return index == 0; } /* Harmless if it was never added */