Skip to content

Commit 836daea

Browse files
committed
gossipd: move timestamp_reasonable into gossmap_manage.c.
It's only used in there anyway. Signed-off-by: Rusty Russell <[email protected]>
1 parent 3963a92 commit 836daea

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

gossipd/gossipd.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -368,21 +368,6 @@ static void master_or_connectd_gone(struct daemon_conn *dc UNUSED)
368368
exit(2);
369369
}
370370

371-
/* We don't check this when loading from the gossip_store: that would break
372-
* our canned tests, and usually old gossip is better than no gossip */
373-
bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp)
374-
{
375-
u64 now = clock_time().ts.tv_sec;
376-
377-
/* More than one day ahead? */
378-
if (timestamp > now + 24*60*60)
379-
return false;
380-
/* More than 2 weeks behind? */
381-
if (timestamp < now - GOSSIP_PRUNE_INTERVAL(daemon->dev_fast_gossip_prune))
382-
return false;
383-
return true;
384-
}
385-
386371
/*~ Parse init message from lightningd: starts the daemon properly. */
387372
static void gossip_init(struct daemon *daemon, const u8 *msg)
388373
{

gossipd/gossipd.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,4 @@ void tell_lightningd_peer_update(struct daemon *daemon,
158158
struct amount_msat htlc_minimum,
159159
struct amount_msat htlc_maximum);
160160

161-
/**
162-
* Is this gossip timestamp reasonable?
163-
*/
164-
bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp);
165-
166161
#endif /* LIGHTNING_GOSSIPD_GOSSIPD_H */

gossipd/gossmap_manage.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,21 @@ static const char *process_channel_update(const tal_t *ctx,
893893
return NULL;
894894
}
895895

896+
/* We don't check this when loading from the gossip_store: that would break
897+
* our canned tests, and usually old gossip is better than no gossip */
898+
static bool timestamp_reasonable(const struct daemon *daemon, u32 timestamp)
899+
{
900+
u64 now = clock_time().ts.tv_sec;
901+
902+
/* More than one day ahead? */
903+
if (timestamp > now + 24*60*60)
904+
return false;
905+
/* More than 2 weeks behind? */
906+
if (timestamp < now - GOSSIP_PRUNE_INTERVAL(daemon->dev_fast_gossip_prune))
907+
return false;
908+
return true;
909+
}
910+
896911
const char *gossmap_manage_channel_update(const tal_t *ctx,
897912
struct gossmap_manage *gm,
898913
const u8 *update TAKES,

0 commit comments

Comments
 (0)