diff options
| author | Max K. <[email protected]> | 2015-08-13 18:41:49 +0200 |
|---|---|---|
| committer | Max K. <[email protected]> | 2015-08-13 18:41:49 +0200 |
| commit | 1027b821df35fbf2e7a05bfe39e0e9cdb90e9cd5 (patch) | |
| tree | e4a4c4b56f4c3ee6e207dded5d448c8f7d7c1ee6 /src/init.cpp | |
| parent | Merge pull request #1233 from patricklodder/1.10-travis-osx-sdk (diff) | |
| parent | advertise block height addition to -blocknotify (diff) | |
| download | discoin-1027b821df35fbf2e7a05bfe39e0e9cdb90e9cd5.tar.xz discoin-1027b821df35fbf2e7a05bfe39e0e9cdb90e9cd5.zip | |
Merge pull request #1238 from rnicoll/1.10-block-notify-height
Add block height to block notification
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index c3a326841..21a566848 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -44,6 +44,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> @@ -269,7 +270,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-?", _("This help message")); strUsage += HelpMessageOpt("-alerts", strprintf(_("Receive and display P2P network alerts (default: %u)"), DEFAULT_ALERTS)); 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)")); strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), 288)); strUsage += HelpMessageOpt("-checklevel=<n>", strprintf(_("How thorough the block verification of -checkblocks is (0-4, default: %u)"), 3)); strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), "bitcoin.conf")); @@ -452,11 +453,12 @@ std::string LicenseInfo() "\n"; } -static void BlockNotifyCallback(const uint256& hashNewTip) +static void BlockNotifyCallback(const uint256& hashNewTip, const int nHeight) { std::string strCmd = GetArg("-blocknotify", ""); boost::replace_all(strCmd, "%s", hashNewTip.GetHex()); + boost::replace_all(strCmd, "%i", boost::lexical_cast<std::string>(chainActive.Height())); boost::thread t(runCommand, strCmd); // thread runs free } |