mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
gossipd: fix gossip_store calling delete.
Now we handle node_announcements properly, we have a failure case where we try to move them when a channel is deleted while loading the store. We're going to remove this soon, in favor of in-place delete, so workaround this for now to avoid an assert() when we try to write to the store while loading. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
21fe518513
commit
763697eb4c
@ -645,3 +645,9 @@ out:
|
||||
gs->len);
|
||||
gs->writable = true;
|
||||
}
|
||||
|
||||
/* FIXME: Remove */
|
||||
bool gossip_store_loading(const struct gossip_store *gs)
|
||||
{
|
||||
return !gs->writable;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user