diff --git a/src/init.cpp b/src/init.cpp index 84398d978..4ff875f9a 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) {