diff options
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index 8ae228bbbe..494342c693 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -367,6 +367,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() { @@ -1184,6 +1192,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)) |