converted from "fix possible block db breakage during re-index" bb6acff079

This commit is contained in:
UdjinM6 2015-03-22 03:15:20 +03:00 committed by Evan Duffield
parent 66d96acd19
commit e3d333f8b2

View File

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