diff options
| author | Ross Nicoll <[email protected]> | 2015-08-11 19:27:05 +0000 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2015-08-11 19:27:05 +0000 |
| commit | b668629143270f9a33ac5cbd4f777be30fd0779e (patch) | |
| tree | 2171a4359fbe42eecb7608044591d5acc643d85c /src | |
| parent | Merge pull request #1233 from patricklodder/1.10-travis-osx-sdk (diff) | |
| download | discoin-b668629143270f9a33ac5cbd4f777be30fd0779e.tar.xz discoin-b668629143270f9a33ac5cbd4f777be30fd0779e.zip | |
Add block height to block notification substitution options
Diffstat (limited to 'src')
| -rw-r--r-- | src/init.cpp | 4 | ||||
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/ui_interface.h | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp index c3a326841..94a08ee8b 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> @@ -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 } diff --git a/src/main.cpp b/src/main.cpp index 92d425ab8..8d408a34b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2424,7 +2424,7 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) { pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip)); } // Notify external listeners about the new tip. - uiInterface.NotifyBlockTip(hashNewTip); + uiInterface.NotifyBlockTip(hashNewTip, pindexNewTip->nHeight); } } while(pindexMostWork != chainActive.Tip()); CheckBlockIndex(); diff --git a/src/ui_interface.h b/src/ui_interface.h index 32a92a4b8..34ac7bf3b 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -94,7 +94,7 @@ public: boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress; /** New block has been accepted */ - boost::signals2::signal<void (const uint256& hash)> NotifyBlockTip; + boost::signals2::signal<void (const uint256& hash, const int nHeight)> NotifyBlockTip; }; extern CClientUIInterface uiInterface; |