common/gossip_store: add flag to *only* fetch "push"-marked messages.

These are the ones which are for our own channels (and our own node_announcement).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-04-20 07:16:35 +09:30
parent ee21ae814a
commit 9b944dbed4
3 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,7 @@ static size_t reopen_gossip_store(int *gossip_store_fd, const u8 *msg)
u8 *gossip_store_next(const tal_t *ctx,
int *gossip_store_fd,
u32 timestamp_min, u32 timestamp_max,
bool push_only,
size_t *off, size_t *end)
{
u8 *msg = NULL;
@ -109,6 +110,8 @@ u8 *gossip_store_next(const tal_t *ctx,
!timestamp_filter(timestamp_min, timestamp_max,
timestamp)) {
msg = tal_free(msg);
} else if (!push && push_only) {
msg = tal_free(msg);
}
}

View File

@ -46,6 +46,7 @@ struct gossip_hdr {
u8 *gossip_store_next(const tal_t *ctx,
int *gossip_store_fd,
u32 timestamp_min, u32 timestamp_max,
bool push_only,
size_t *off, size_t *end);
/**

View File

@ -367,6 +367,7 @@ again:
msg = gossip_store_next(ctx, &peer->daemon->gossip_store_fd,
peer->gs.timestamp_min,
peer->gs.timestamp_max,
false,
&peer->gs.off,
&peer->daemon->gossip_store_end);
/* Don't send back gossip they sent to us! */