diff options
| author | Ross Nicoll <[email protected]> | 2018-01-20 17:32:36 +0000 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2018-09-19 22:11:47 +0100 |
| commit | ea52cb3ae04196f8b8c08a646102e14c3f2d374b (patch) | |
| tree | 5d2883177170a0ac836bf53ef03d2930fbe56d6f /src/init.cpp | |
| parent | Enforce minor Dogecoin parameters (#1427) (diff) | |
| download | discoin-ea52cb3ae04196f8b8c08a646102e14c3f2d374b.tar.xz discoin-ea52cb3ae04196f8b8c08a646102e14c3f2d374b.zip | |
Add block height to block notification substitution options (#1430)
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index c4b446c52..31f3576b6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -58,6 +58,7 @@ #include <boost/filesystem.hpp> #include <boost/function.hpp> #include <boost/interprocess/sync/file_lock.hpp> +#include <boost/lexical_cast.hpp> #include <boost/thread.hpp> #include <openssl/crypto.h> @@ -325,7 +326,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-?", _("Print this help message and exit")); strUsage += HelpMessageOpt("-version", _("Print version and exit")); strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)")); - strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash)")); + strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash, %i is replaced by block number)")); if (showDebug) strUsage += HelpMessageOpt("-blocksonly", strprintf(_("Whether to operate in a blocks only mode (default: %u)"), DEFAULT_BLOCKSONLY)); strUsage +=HelpMessageOpt("-assumevalid=<hex>", strprintf(_("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)"), Params(CBaseChainParams::MAIN).GetConsensus(0).defaultAssumeValid.GetHex(), Params(CBaseChainParams::TESTNET).GetConsensus(0).defaultAssumeValid.GetHex())); @@ -535,6 +536,7 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex std::string strCmd = GetArg("-blocknotify", ""); boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); + boost::replace_all(strCmd, "%i", boost::lexical_cast<std::string>(pBlockIndex->nHeight)); boost::thread t(runCommand, strCmd); // thread runs free } |