diff --git a/common/gossip_store.c b/common/gossip_store.c index b36897aca653..4fdcde1e4d16 100644 --- a/common/gossip_store.c +++ b/common/gossip_store.c @@ -77,8 +77,16 @@ u8 *gossip_store_next(const tal_t *ctx, continue; } - checksum = be32_to_cpu(hdr.crc); + /* Skip any timestamp filtered */ timestamp = be32_to_cpu(hdr.timestamp); + if (!push && + !timestamp_filter(timestamp_min, timestamp_max, + timestamp)) { + *off += r + msglen; + continue; + } + + checksum = be32_to_cpu(hdr.crc); msg = tal_arr(ctx, u8, msglen); r = pread(*gossip_store_fd, msg, msglen, *off + r); if (r != msglen) @@ -105,10 +113,6 @@ u8 *gossip_store_next(const tal_t *ctx, && type != WIRE_CHANNEL_UPDATE && type != WIRE_NODE_ANNOUNCEMENT) { msg = tal_free(msg); - } else if (!push && - !timestamp_filter(timestamp_min, timestamp_max, - timestamp)) { - msg = tal_free(msg); } else if (!push && push_only) { msg = tal_free(msg); } diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index f06c5a876678..1032d415c75b 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -277,7 +277,7 @@ static u32 gossip_store_compact_offline(struct routing_state *rstate) oldlen = lseek(old_fd, SEEK_END, 0); newlen = lseek(new_fd, SEEK_END, 0); append_msg(old_fd, towire_gossip_store_ended(tmpctx, newlen), - 0, false, &oldlen); + 0, true, &oldlen); close(old_fd); status_debug("gossip_store_compact_offline: %zu deleted, %zu copied", deleted, count); @@ -565,7 +565,7 @@ bool gossip_store_compact(struct gossip_store *gs) /* Write end marker now new one is ready */ append_msg(gs->fd, towire_gossip_store_ended(tmpctx, len), - 0, false, &gs->len); + 0, true, &gs->len); gs->count = count; gs->deleted = 0;