MCPcopy Create free account
hub / github.com/ElementsProject/lightning / update_recent_timestamp

Function update_recent_timestamp

connectd/connectd.c:2273–2286  ·  view source on GitHub ↗

It's so common to ask for "recent" gossip (we ask for 10 minutes * ago, LND and Eclair ask for now, LDK asks for 1 hour ago) that it's * worth keeping track of where that starts, so we can skip most of * the store. */

Source from the content-addressed store, hash-verified

2271 * worth keeping track of where that starts, so we can skip most of
2272 * the store. */
2273void update_recent_timestamp(struct daemon *daemon, struct gossmap *gossmap)
2274{
2275 /* 2 hours allows for some clock drift, not too much gossip */
2276 u32 recent = clock_time().ts.tv_sec - 7200;
2277
2278 /* Only update every minute */
2279 if (daemon->gossip_recent_time + 60 > recent)
2280 return;
2281
2282 daemon->gossip_recent_time = recent;
2283 gossmap_iter_fast_forward(gossmap,
2284 daemon->gossmap_iter_recent,
2285 recent);
2286}
2287
2288static void connectd_logcb(struct daemon *daemon,
2289 enum log_level level,

Callers 2

setup_gossip_storeFunction · 0.85

Calls 2

clock_timeFunction · 0.85

Tested by

no test coverage detected