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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-07-15 15:28:45 +09:30
parent 50180e040c
commit 92fe871467

View file

@ -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.