gossip_store: clean up a truncated store.

We might have channel_announcements which have no channel_update: normally
these don't get written into the store until there is one, but if the
store was truncated it can happen.  We then get upset on compaction, since
we don't have an in-memory representation of the channel_announcement.

Similarly, we leave the node_announcement pending until after that
channel_announcement, leading to a similar case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-06-14 13:00:56 +09:30
committed by Christian Decker
parent adc52b6ee8
commit 10c503b4b4
4 changed files with 91 additions and 9 deletions

View File

@@ -437,4 +437,12 @@ struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser);
void remove_channel_from_store(struct routing_state *rstate,
struct chan *chan);
/* gossip_store wants to delete any dangling entries immediately after
* load; return 0 if no more, otherwise index into store.
*
* Must call remove_unfinalized_node_announce first, because removing
* unupdated channels may delete associatd node_announcements. */
u32 remove_unfinalized_node_announce(struct routing_state *rstate);
u32 remove_unupdated_channel_announce(struct routing_state *rstate);
#endif /* LIGHTNING_GOSSIPD_ROUTING_H */