diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-11 08:33:45 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-11 08:33:52 +0100 |
commit | 45b7dc2c25a5e977cc45c483d6dd6094ceb2e7a8 (patch) | |
tree | 6f39c4416f5568c3870db057018b244b6479a757 /src | |
parent | 8cbe1f4f5870a165be729cabb9b55dcbf0f85e09 (diff) | |
parent | bb6acff07982dda68b5c2ac81c99dbd7255bb9cc (diff) |
Merge pull request #5864
bb6acff fix possible block db breakage during re-index (Cory Fields)
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0b36b5f219..e16887fa4a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; |