From 92fe871467e32a6631b473398341a9dc16edd7b2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Jul 2022 15:28:45 +0930 Subject: [PATCH] connectd: optimize case where peer doesn't want gossip. LND and us send 0xFFFFFFFF to turn off gossip. LDK and Eclair don't seem to turn off gossip at all, but that's OK. Signed-off-by: Rusty Russell --- connectd/multiplex.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/connectd/multiplex.c b/connectd/multiplex.c index f9d41bcae..c53886196 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -632,7 +632,12 @@ static void handle_gossip_timestamp_filter_in(struct peer *peer, const u8 *msg) if (peer->gs.timestamp_max < peer->gs.timestamp_min) peer->gs.timestamp_max = UINT32_MAX; - peer->gs.off = 1; + /* Optimization: they don't want anything. LND and us (at least), + * both set first_timestamp to 0xFFFFFFFF to indicate that. */ + if (peer->gs.timestamp_min == UINT32_MAX) + peer->gs.off = peer->daemon->gossip_store_end; + else + peer->gs.off = 1; /* BOLT #7: * - MAY wait for the next outgoing gossip flush to send these.