From 24cc371cdf7350d2d2b6ec09de0b94b844d18cee Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 14 Jun 2019 10:05:12 +0930 Subject: [PATCH] gossipd: gossip_store errors after rewrite are fatal. We can't continue, since we've moved the indexes. We'll just crash anyway, as seen from bugs #2742 and #2743. Signed-off-by: Rusty Russell --- gossipd/gossip_store.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 1dc6ab6bf..0ba89aa92 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -311,24 +311,23 @@ bool gossip_store_compact(struct gossip_store *gs) "gossip_store: Entry at %zu->%zu not updated?", omap->from, omap->to); - if (count != gs->count - gs->deleted) { - status_broken("Expected %zu msgs in new gossip store, got %zu", + if (count != gs->count - gs->deleted) + status_failed(STATUS_FAIL_INTERNAL_ERROR, + "gossip_store: Expected %zu msgs in new" + " gossip store, got %zu", gs->count - gs->deleted, count); - goto unlink_disable; - } - if (deleted != gs->deleted) { - status_broken("Expected %zu deleted msgs in old gossip store, got %zu", + if (deleted != gs->deleted) + status_failed(STATUS_FAIL_INTERNAL_ERROR, + "gossip_store: Expected %zu deleted msgs in old" + " gossip store, got %zu", gs->deleted, deleted); - goto unlink_disable; - } - if (rename(GOSSIP_STORE_TEMP_FILENAME, GOSSIP_STORE_FILENAME) == -1) { - status_broken( - "Error swapping compacted gossip_store into place: %s", - strerror(errno)); - goto unlink_disable; - } + if (rename(GOSSIP_STORE_TEMP_FILENAME, GOSSIP_STORE_FILENAME) == -1) + status_failed(STATUS_FAIL_INTERNAL_ERROR, + "Error swapping compacted gossip_store into place:" + " %s", + strerror(errno)); status_trace( "Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64,