From 9b944dbed4c121a912c2380d71a228fcc3c2a180 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 20 Apr 2022 07:16:35 +0930 Subject: [PATCH] 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 --- common/gossip_store.c | 3 +++ common/gossip_store.h | 1 + connectd/multiplex.c | 1 + 3 files changed, 5 insertions(+) diff --git a/common/gossip_store.c b/common/gossip_store.c index 686b1f177..eba8a5ab0 100644 --- a/common/gossip_store.c +++ b/common/gossip_store.c @@ -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); } } diff --git a/common/gossip_store.h b/common/gossip_store.h index b5d8fad19..8fa6ee145 100644 --- a/common/gossip_store.h +++ b/common/gossip_store.h @@ -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); /** diff --git a/connectd/multiplex.c b/connectd/multiplex.c index fafc326a9..8a94a33ee 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -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! */