aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2014-08-29 15:23:13 -0400
committerJeff Garzik <jgarzik@bitpay.com>2014-08-29 15:23:13 -0400
commit309aa76d279d2986b8d5a3756a38380c97107db7 (patch)
tree3a3b49819669e27d6b76d7b3d99b99c3b802505c /src/init.cpp
parent539abc4729ea16039d148cfa3b771929f7d37584 (diff)
parentc7b6117debf4ebabc464a55b840bdd7bdeb94fa3 (diff)
downloadbitcoin-309aa76d279d2986b8d5a3756a38380c97107db7.tar.xz
Merge pull request #4599
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e972413c4b..c49083c7df 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -369,6 +369,14 @@ std::string LicenseInfo()
"\n";
}
+static void BlockNotifyCallback(const uint256& hashNewTip)
+{
+ std::string strCmd = GetArg("-blocknotify", "");
+
+ boost::replace_all(strCmd, "%s", hashNewTip.GetHex());
+ boost::thread t(runCommand, strCmd); // thread runs free
+}
+
struct CImportingNow
{
CImportingNow() {
@@ -1185,6 +1193,9 @@ bool AppInit2(boost::thread_group& threadGroup)
#endif // !ENABLE_WALLET
// ********************************************************* Step 9: import blocks
+ if (mapArgs.count("-blocknotify"))
+ uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
+
// scan for better chains in the block chain database, that are not yet connected in the active best chain
CValidationState state;
if (!ActivateBestChain(state))