diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 871dc008a..f6986ee63 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -645,3 +645,9 @@ out: gs->len); gs->writable = true; } + +/* FIXME: Remove */ +bool gossip_store_loading(const struct gossip_store *gs) +{ + return !gs->writable; +} diff --git a/gossipd/gossip_store.h b/gossipd/gossip_store.h index 317bd35e8..743e6b0c5 100644 --- a/gossipd/gossip_store.h +++ b/gossipd/gossip_store.h @@ -74,4 +74,7 @@ bool gossip_store_compact(struct gossip_store *gs, */ int gossip_store_readonly_fd(struct gossip_store *gs); +/* FIXME: Remove */ +bool gossip_store_loading(const struct gossip_store *gs); + #endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_H */ diff --git a/gossipd/routing.c b/gossipd/routing.c index a4bd31287..ada96cec2 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -337,6 +337,12 @@ static void remove_chan_from_node(struct routing_state *rstate, if (!node->bcast.index) return; + /* FIXME: Remove when we get rid of WIRE_GOSSIP_STORE_CHANNEL_DELETE. + * For the moment, it can cause us to try to write to the store. */ + (void)WIRE_GOSSIP_STORE_CHANNEL_DELETE; + if (gossip_store_loading(rstate->broadcasts->gs)) + return; + /* Removed only public channel? Remove node announcement. */ if (!node_has_broadcastable_channels(node)) { broadcast_del(rstate->broadcasts, &node->bcast);