aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2018-02-11 12:14:08 +0100
committerSjors Provoost <sjors@sprovoost.nl>2018-02-11 12:14:08 +0100
commita8b5d20f4f171828b2bd70ab2405c42b1e452e5b (patch)
treebeff8292730edb510c67d192770cd909b507242c
parent89005ddad1c4a9732ecae47c7de34b4de157f48f (diff)
Reset pblocktree before deleting LevelDB file
-rw-r--r--src/init.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 84398d978c..4ff875f9aa 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1425,6 +1425,9 @@ bool AppInitMain()
pcoinsTip.reset();
pcoinsdbview.reset();
pcoinscatcher.reset();
+ // new CBlockTreeDB tries to delete the existing file, which
+ // fails if it's still open from the previous loop. Close it first:
+ pblocktree.reset();
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset));
if (fReset) {