aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-03-11 08:33:45 +0100
committerWladimir J. van der Laan <[email protected]>2015-03-11 08:33:52 +0100
commit45b7dc2c25a5e977cc45c483d6dd6094ceb2e7a8 (patch)
tree6f39c4416f5568c3870db057018b244b6479a757 /src/main.cpp
parenttests: change main and wallet tests to BOOST_FIXTURE_TEST_SUITE (diff)
parentfix possible block db breakage during re-index (diff)
downloaddiscoin-45b7dc2c25a5e977cc45c483d6dd6094ceb2e7a8.tar.xz
discoin-45b7dc2c25a5e977cc45c483d6dd6094ceb2e7a8.zip
Merge pull request #5864
bb6acff fix possible block db breakage during re-index (Cory Fields)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0b36b5f21..e16887fa4 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;