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. */
| 213 | * worth keeping track of where that starts, so we can skip most of |
| 214 | * the store. */ |
| 215 | static void update_recent_timestamp(struct daemon *daemon) |
| 216 | { |
| 217 | /* 2 hours allows for some clock drift, not too much gossip */ |
| 218 | u32 recent = time_now().ts.tv_sec - 7200; |
| 219 | |
| 220 | /* Only update every minute */ |
| 221 | if (daemon->gossip_recent_time + 60 > recent) |
| 222 | return; |
| 223 | |
| 224 | daemon->gossip_recent_time = recent; |
| 225 | daemon->gossip_store_recent_off |
| 226 | = find_gossip_store_by_timestamp(daemon->gossip_store_fd, |
| 227 | daemon->gossip_store_recent_off, |
| 228 | daemon->gossip_recent_time); |
| 229 | } |
| 230 | |
| 231 | /* This is called once we need it: otherwise, the gossip_store may not exist, |
| 232 | * since we start at the same time as gossipd itself. */ |
no test coverage detected