diff --git a/connectd/gossip_store.c b/connectd/gossip_store.c index 931bf1d408b4..2dbf6bb5164e 100644 --- a/connectd/gossip_store.c +++ b/connectd/gossip_store.c @@ -121,7 +121,7 @@ u8 *gossip_store_next(const tal_t *ctx, struct gossip_hdr hdr; u16 msglen, flags; u32 checksum, timestamp; - bool push, ratelimited; + bool ratelimited; int type, r; r = pread(*gossip_store_fd, &hdr, sizeof(hdr), *off); @@ -130,7 +130,6 @@ u8 *gossip_store_next(const tal_t *ctx, msglen = be16_to_cpu(hdr.len); flags = be16_to_cpu(hdr.flags); - push = (flags & GOSSIP_STORE_PUSH_BIT); ratelimited = (flags & GOSSIP_STORE_RATELIMIT_BIT); /* Skip any deleted entries. */ @@ -141,8 +140,7 @@ u8 *gossip_store_next(const tal_t *ctx, /* Skip any timestamp filtered */ timestamp = be32_to_cpu(hdr.timestamp); - if (!push && - !timestamp_filter(timestamp_min, timestamp_max, + if (!timestamp_filter(timestamp_min, timestamp_max, timestamp)) { *off += r + msglen; continue; diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 8c9dcccb61bd..51051c842ce9 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -73,7 +73,7 @@ static ssize_t gossip_pwritev(int fd, const struct iovec *iov, int iovcnt, #endif /* !HAVE_PWRITEV */ static bool append_msg(int fd, const u8 *msg, u32 timestamp, - bool push, bool zombie, bool spam, u64 *len) + bool zombie, bool spam, u64 *len) { struct gossip_hdr hdr; u32 msglen; @@ -85,8 +85,6 @@ static bool append_msg(int fd, const u8 *msg, u32 timestamp, msglen = tal_count(msg); hdr.len = cpu_to_be16(msglen); hdr.flags = 0; - if (push) - hdr.flags |= CPU_TO_BE16(GOSSIP_STORE_PUSH_BIT); if (spam) hdr.flags |= CPU_TO_BE16(GOSSIP_STORE_RATELIMIT_BIT); if (zombie) @@ -251,7 +249,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, true, false, false, &oldlen); + 0, false, false, &oldlen); close(old_fd); status_debug("gossip_store_compact_offline: %zu deleted, %zu copied", deleted, count); @@ -533,7 +531,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, true, false, false, &gs->len); + 0, false, false, &gs->len); gs->count = count; gs->deleted = 0; @@ -553,7 +551,7 @@ bool gossip_store_compact(struct gossip_store *gs) } u64 gossip_store_add(struct gossip_store *gs, const u8 *gossip_msg, - u32 timestamp, bool push, bool zombie, + u32 timestamp, bool zombie, bool spam, const u8 *addendum) { u64 off = gs->len; @@ -561,12 +559,12 @@ u64 gossip_store_add(struct gossip_store *gs, const u8 *gossip_msg, /* Should never get here during loading! */ assert(gs->writable); - if (!append_msg(gs->fd, gossip_msg, timestamp, push, zombie, spam, &gs->len)) { + if (!append_msg(gs->fd, gossip_msg, timestamp, zombie, spam, &gs->len)) { status_broken("Failed writing to gossip store: %s", strerror(errno)); return 0; } - if (addendum && !append_msg(gs->fd, addendum, 0, false, false, false, &gs->len)) { + if (addendum && !append_msg(gs->fd, addendum, 0, false, false, &gs->len)) { status_broken("Failed writing addendum to gossip store: %s", strerror(errno)); return 0; @@ -583,7 +581,7 @@ u64 gossip_store_add_private_update(struct gossip_store *gs, const u8 *update) /* A local update for an unannounced channel: not broadcastable, but * otherwise the same as a normal channel_update */ const u8 *pupdate = towire_gossip_store_private_update(tmpctx, update); - return gossip_store_add(gs, pupdate, 0, false, false, false, NULL); + return gossip_store_add(gs, pupdate, 0, false, false, NULL); } /* Returns index of following entry. */ @@ -645,7 +643,7 @@ void gossip_store_mark_channel_deleted(struct gossip_store *gs, const struct short_channel_id *scid) { gossip_store_add(gs, towire_gossip_store_delete_chan(tmpctx, scid), - 0, false, false, false, NULL); + 0, false, false, NULL); } static void mark_zombie(struct gossip_store *gs, diff --git a/gossipd/gossip_store.h b/gossipd/gossip_store.h index d6f76e176716..36d29d21682e 100644 --- a/gossipd/gossip_store.h +++ b/gossipd/gossip_store.h @@ -46,7 +46,7 @@ u64 gossip_store_add_private_update(struct gossip_store *gs, const u8 *update); * (for appending amounts to channel_announcements for internal use). */ u64 gossip_store_add(struct gossip_store *gs, const u8 *gossip_msg, - u32 timestamp, bool push, bool zombie, bool spam, + u32 timestamp, bool zombie, bool spam, const u8 *addendum); diff --git a/gossipd/routing.c b/gossipd/routing.c index 1e8bd3a433f5..17e4bcf35bfa 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -458,7 +458,6 @@ static void force_node_announce_rexmit(struct routing_state *rstate, struct node *node) { const u8 *announce; - bool is_local = node_id_eq(&node->id, &rstate->local_id); announce = gossip_store_get(tmpctx, rstate->gs, node->bcast.index); u32 initial_bcast_index = node->bcast.index; @@ -468,7 +467,6 @@ static void force_node_announce_rexmit(struct routing_state *rstate, node->bcast.index = gossip_store_add(rstate->gs, announce, node->bcast.timestamp, - is_local, false, false, NULL); @@ -482,7 +480,6 @@ static void force_node_announce_rexmit(struct routing_state *rstate, node->rgraph.index = gossip_store_add(rstate->gs, announce, node->rgraph.timestamp, - is_local, false, true, NULL); @@ -852,7 +849,6 @@ static void add_channel_announce_to_broadcast(struct routing_state *rstate, chan->bcast.index = gossip_store_add(rstate->gs, channel_announce, chan->bcast.timestamp, - is_local, false, false, addendum); @@ -1538,7 +1534,6 @@ bool routing_add_channel_update(struct routing_state *rstate, chan->bcast.index = gossip_store_add(rstate->gs, zombie_announcement, chan->bcast.timestamp, - local_direction(rstate, chan, NULL), false, false, zombie_addendum); /* Deletion of the old addendum is optional. */ /* This opposing channel_update has been stashed away. Now that @@ -1562,13 +1557,11 @@ bool routing_add_channel_update(struct routing_state *rstate, chan->half[!direction].bcast.index = gossip_store_add(rstate->gs, zombie_update[0], chan->half[!direction].bcast.timestamp, - local_direction(rstate, chan, NULL), false, false, NULL); if (zombie_update[1]) chan->half[!direction].rgraph.index = gossip_store_add(rstate->gs, zombie_update[1], chan->half[!direction].rgraph.timestamp, - local_direction(rstate, chan, NULL), false, true, NULL); else chan->half[!direction].rgraph.index = chan->half[!direction].bcast.index; @@ -1587,7 +1580,6 @@ bool routing_add_channel_update(struct routing_state *rstate, } else { hc->rgraph.index = gossip_store_add(rstate->gs, update, timestamp, - local_direction(rstate, chan, NULL), zombie, spam, NULL); if (hc->bcast.timestamp > rstate->last_timestamp && hc->bcast.timestamp < time_now().ts.tv_sec) @@ -1910,8 +1902,6 @@ bool routing_add_node_announcement(struct routing_state *rstate, } else { node->rgraph.index = gossip_store_add(rstate->gs, msg, timestamp, - node_id_eq(&node_id, - &rstate->local_id), false, spam, NULL); if (node->bcast.timestamp > rstate->last_timestamp && node->bcast.timestamp < time_now().ts.tv_sec) @@ -2144,7 +2134,7 @@ bool routing_add_private_channel(struct routing_state *rstate, capacity, chan_ann); index = gossip_store_add(rstate->gs, msg, 0, false, false, - false, NULL); + NULL); } chan->bcast.index = index; return true; @@ -2289,7 +2279,7 @@ void routing_channel_spent(struct routing_state *rstate, /* Save to gossip_store in case we restart */ msg = towire_gossip_store_chan_dying(tmpctx, &chan->scid, deadline); - index = gossip_store_add(rstate->gs, msg, 0, false, false, false, NULL); + index = gossip_store_add(rstate->gs, msg, 0, false, false, NULL); /* Remember locally so we can kill it in 12 blocks */ status_debug("channel %s closing soon due" diff --git a/gossipd/test/run-check_channel_announcement.c b/gossipd/test/run-check_channel_announcement.c index bd3cf97dcf2a..127d341355d5 100644 --- a/gossipd/test/run-check_channel_announcement.c +++ b/gossipd/test/run-check_channel_announcement.c @@ -61,7 +61,7 @@ bool cupdate_different(struct gossip_store *gs UNNEEDED, { fprintf(stderr, "cupdate_different called!\n"); abort(); } /* Generated stub for gossip_store_add */ u64 gossip_store_add(struct gossip_store *gs UNNEEDED, const u8 *gossip_msg UNNEEDED, - u32 timestamp UNNEEDED, bool push UNNEEDED, bool zombie UNNEEDED, bool spam UNNEEDED, + u32 timestamp UNNEEDED, bool zombie UNNEEDED, bool spam UNNEEDED, const u8 *addendum UNNEEDED) { fprintf(stderr, "gossip_store_add called!\n"); abort(); } /* Generated stub for gossip_store_add_private_update */ diff --git a/gossipd/test/run-txout_failure.c b/gossipd/test/run-txout_failure.c index 5db4ef8f3c0f..3cb97cbee084 100644 --- a/gossipd/test/run-txout_failure.c +++ b/gossipd/test/run-txout_failure.c @@ -32,7 +32,7 @@ bool cupdate_different(struct gossip_store *gs UNNEEDED, { fprintf(stderr, "cupdate_different called!\n"); abort(); } /* Generated stub for gossip_store_add */ u64 gossip_store_add(struct gossip_store *gs UNNEEDED, const u8 *gossip_msg UNNEEDED, - u32 timestamp UNNEEDED, bool push UNNEEDED, bool zombie UNNEEDED, bool spam UNNEEDED, + u32 timestamp UNNEEDED, bool zombie UNNEEDED, bool spam UNNEEDED, const u8 *addendum UNNEEDED) { fprintf(stderr, "gossip_store_add called!\n"); abort(); } /* Generated stub for gossip_store_add_private_update */