aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp44
-rw-r--r--src/main.cpp44
-rw-r--r--src/main.h1
3 files changed, 45 insertions, 44 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 8151fb2a86..6fa8586426 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -310,6 +310,50 @@ std::string HelpMessage()
}
+struct CImportingNow
+{
+ CImportingNow() {
+ assert(fImporting == false);
+ fImporting = true;
+ }
+
+ ~CImportingNow() {
+ assert(fImporting == true);
+ fImporting = false;
+ }
+};
+
+void ThreadImport(void *data) {
+ std::vector<boost::filesystem::path> *vFiles = reinterpret_cast<std::vector<boost::filesystem::path>*>(data);
+
+ RenameThread("bitcoin-loadblk");
+
+ CImportingNow imp;
+ vnThreadsRunning[THREAD_IMPORT]++;
+
+ // -loadblock=
+ BOOST_FOREACH(boost::filesystem::path &path, *vFiles) {
+ FILE *file = fopen(path.string().c_str(), "rb");
+ if (file)
+ LoadExternalBlockFile(file);
+ }
+
+ // hardcoded $DATADIR/bootstrap.dat
+ filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
+ if (filesystem::exists(pathBootstrap)) {
+ FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
+ if (file) {
+ filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
+ LoadExternalBlockFile(file);
+ RenameOver(pathBootstrap, pathBootstrapOld);
+ }
+ }
+
+ delete vFiles;
+
+ vnThreadsRunning[THREAD_IMPORT]--;
+}
+
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
diff --git a/src/main.cpp b/src/main.cpp
index 7a9a32a626..64adae8edd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2532,50 +2532,6 @@ bool LoadExternalBlockFile(FILE* fileIn)
return nLoaded > 0;
}
-struct CImportingNow
-{
- CImportingNow() {
- assert(fImporting == false);
- fImporting = true;
- }
-
- ~CImportingNow() {
- assert(fImporting == true);
- fImporting = false;
- }
-};
-
-void ThreadImport(void *data) {
- std::vector<boost::filesystem::path> *vFiles = reinterpret_cast<std::vector<boost::filesystem::path>*>(data);
-
- RenameThread("bitcoin-loadblk");
-
- CImportingNow imp;
- vnThreadsRunning[THREAD_IMPORT]++;
-
- // -loadblock=
- BOOST_FOREACH(boost::filesystem::path &path, *vFiles) {
- FILE *file = fopen(path.string().c_str(), "rb");
- if (file)
- LoadExternalBlockFile(file);
- }
-
- // hardcoded $DATADIR/bootstrap.dat
- filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
- if (filesystem::exists(pathBootstrap)) {
- FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
- if (file) {
- filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
- LoadExternalBlockFile(file);
- RenameOver(pathBootstrap, pathBootstrapOld);
- }
- }
-
- delete vFiles;
-
- vnThreadsRunning[THREAD_IMPORT]--;
-}
-
diff --git a/src/main.h b/src/main.h
index 899cabd85a..c2ecefa8f0 100644
--- a/src/main.h
+++ b/src/main.h
@@ -113,6 +113,7 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock);
bool CheckDiskSpace(uint64 nAdditionalBytes=0);
FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly = false);
FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false);
+bool LoadExternalBlockFile(FILE* fileIn);
bool LoadBlockIndex(bool fAllowNew=true);
void PrintBlockTree();
CBlockIndex* FindBlockByHeight(int nHeight);