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

Function update_recent_timestamp

connectd/connectd.c:2266–2279  ·  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

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

Callers 2

setup_gossip_storeFunction · 0.85

Calls 2

clock_timeFunction · 0.85

Tested by

no test coverage detected