Skip to content

Commit 45b7dc2

Browse files
committed
Merge pull request #5864
bb6acff fix possible block db breakage during re-index (Cory Fields)
2 parents 8cbe1f4 + bb6acff commit 45b7dc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2454,8 +2454,11 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd
24542454
}
24552455

24562456
nLastBlockFile = nFile;
2457-
vinfoBlockFile[nFile].nSize += nAddSize;
24582457
vinfoBlockFile[nFile].AddBlock(nHeight, nTime);
2458+
if (fKnown)
2459+
vinfoBlockFile[nFile].nSize = std::max(pos.nPos + nAddSize, vinfoBlockFile[nFile].nSize);
2460+
else
2461+
vinfoBlockFile[nFile].nSize += nAddSize;
24592462

24602463
if (!fKnown) {
24612464
unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;

0 commit comments

Comments
 (0)