Merge pull request #5864

bb6acff fix possible block db breakage during re-index (Cory Fields)
This commit is contained in:
Wladimir J. van der Laan 2015-03-11 08:33:45 +01:00
commit 45b7dc2c25
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 4 additions and 1 deletions

View File

@ -2454,8 +2454,11 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd
}
nLastBlockFile = nFile;
vinfoBlockFile[nFile].nSize += nAddSize;
vinfoBlockFile[nFile].AddBlock(nHeight, nTime);
if (fKnown)
vinfoBlockFile[nFile].nSize = std::max(pos.nPos + nAddSize, vinfoBlockFile[nFile].nSize);
else
vinfoBlockFile[nFile].nSize += nAddSize;
if (!fKnown) {
unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE;