aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2014-09-08 13:29:14 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2014-09-10 13:51:53 -0400
commitec7eb0fa80ce50f0c45c7f764bf4958224721ca0 (patch)
treece421586d0340a7f10fae45f9f844b0f38301148 /src/init.cpp
parentdf623d83dad6aa39141b066ebd2f870ee05acf41 (diff)
downloadbitcoin-ec7eb0fa80ce50f0c45c7f764bf4958224721ca0.tar.xz
When reindexing check for file before trying to open (refactored)
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 31f64878fb..4b95f29365 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -401,9 +401,11 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
int nFile = 0;
while (true) {
CDiskBlockPos pos(nFile, 0);
+ if (!boost::filesystem::exists(GetBlockPosFilename(pos, "blk")))
+ break; // No block files left to reindex
FILE *file = OpenBlockFile(pos, true);
if (!file)
- break;
+ break; // This error is logged in OpenBlockFile
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
LoadExternalBlockFile(file, &pos);
nFile++;