Skip to content

Commit a8b5d20

Browse files
committed
Reset pblocktree before deleting LevelDB file
1 parent 89005dd commit a8b5d20

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/init.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,9 @@ bool AppInitMain()
14251425
pcoinsTip.reset();
14261426
pcoinsdbview.reset();
14271427
pcoinscatcher.reset();
1428+
// new CBlockTreeDB tries to delete the existing file, which
1429+
// fails if it's still open from the previous loop. Close it first:
1430+
pblocktree.reset();
14281431
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset));
14291432

14301433
if (fReset) {

0 commit comments

Comments
 (0)