From d6f6d46c3bf22690a70ac2d314da7f9f75479d84 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 9 Dec 2025 13:02:25 +1030 Subject: [PATCH] gossipd: move timestamp_reasonable into gossmap_manage.c. It's only used in there anyway. Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 15 --------------- gossipd/gossipd.h | 5 ----- gossipd/gossmap_manage.c | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index e6730d187..f82833b68 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -368,21 +368,6 @@ static void master_or_connectd_gone(struct daemon_conn *dc UNUSED) exit(2); } -/* We don't check this when loading from the gossip_store: that would break - * our canned tests, and usually old gossip is better than no gossip */ -bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp) -{ - u64 now = clock_time().ts.tv_sec; - - /* More than one day ahead? */ - if (timestamp > now + 24*60*60) - return false; - /* More than 2 weeks behind? */ - if (timestamp < now - GOSSIP_PRUNE_INTERVAL(daemon->dev_fast_gossip_prune)) - return false; - return true; -} - /*~ Parse init message from lightningd: starts the daemon properly. */ static void gossip_init(struct daemon *daemon, const u8 *msg) { diff --git a/gossipd/gossipd.h b/gossipd/gossipd.h index 93d793738..d8aa5447a 100644 --- a/gossipd/gossipd.h +++ b/gossipd/gossipd.h @@ -158,9 +158,4 @@ void tell_lightningd_peer_update(struct daemon *daemon, struct amount_msat htlc_minimum, struct amount_msat htlc_maximum); -/** - * Is this gossip timestamp reasonable? - */ -bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp); - #endif /* LIGHTNING_GOSSIPD_GOSSIPD_H */ diff --git a/gossipd/gossmap_manage.c b/gossipd/gossmap_manage.c index fb9a1d856..7a371d0f6 100644 --- a/gossipd/gossmap_manage.c +++ b/gossipd/gossmap_manage.c @@ -893,6 +893,21 @@ static const char *process_channel_update(const tal_t *ctx, return NULL; } +/* We don't check this when loading from the gossip_store: that would break + * our canned tests, and usually old gossip is better than no gossip */ +static bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp) +{ + u64 now = clock_time().ts.tv_sec; + + /* More than one day ahead? */ + if (timestamp > now + 24*60*60) + return false; + /* More than 2 weeks behind? */ + if (timestamp < now - GOSSIP_PRUNE_INTERVAL(daemon->dev_fast_gossip_prune)) + return false; + return true; +} + const char *gossmap_manage_channel_update(const tal_t *ctx, struct gossmap_manage *gm, const u8 *update TAKES,