aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-05-26 10:36:19 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-05-26 10:41:17 +0200
commite9af4e65b5afaa870f6cdcf2f7c2ee56c703bffa (patch)
tree97a975217069313fb51b2e9f3225c65dd2fc313c /src/init.cpp
parente1412d3e96ff11d05d727bebedcc42698853cccc (diff)
parent36cba8f1182e8284ec0017e57c5ffb519cd9798f (diff)
Merge pull request #5947
36cba8f Alert if it is very likely we are getting a bad chain (Gavin Andresen)
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b44233d90f..dc9080fec3 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -39,7 +39,9 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
+#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
+#include <boost/function.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/thread.hpp>
#include <openssl/crypto.h>
@@ -1392,6 +1394,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
StartNode(threadGroup, scheduler);
+ // Monitor the chain, and alert if we get blocks much quicker or slower than expected
+ int64_t nPowTargetSpacing = Params().GetConsensus().nPowTargetSpacing;
+ CScheduler::Function f = boost::bind(&PartitionCheck, &IsInitialBlockDownload,
+ boost::ref(cs_main), boost::cref(chainActive), nPowTargetSpacing);
+ scheduler.scheduleEvery(f, nPowTargetSpacing);
+
#ifdef ENABLE_WALLET
// Generate coins in the background
if (pwalletMain)