aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-03-11 08:33:45 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-03-11 08:33:52 +0100
commit45b7dc2c25a5e977cc45c483d6dd6094ceb2e7a8 (patch)
tree6f39c4416f5568c3870db057018b244b6479a757
parent8cbe1f4f5870a165be729cabb9b55dcbf0f85e09 (diff)
parentbb6acff07982dda68b5c2ac81c99dbd7255bb9cc (diff)
Merge pull request #5864
bb6acff fix possible block db breakage during re-index (Cory Fields)
-rw-r--r--src/main.cpp5
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;