Browse Source

Check that -blocknotify command is non-empty before executing

To make BlockNotifyCallback(...) (-blocknotify) consistent with:
* AlertNotify(...) (-alertnotify)
* AddToWallet(...) (-walletnotify)
0.16
practicalswift 8 years ago
parent
commit
6fb8f5f17c
  1. 3
      src/init.cpp
  2. 2
      src/wallet/wallet.cpp

3
src/init.cpp

@ -547,9 +547,10 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex
return; return;
std::string strCmd = gArgs.GetArg("-blocknotify", ""); std::string strCmd = gArgs.GetArg("-blocknotify", "");
if (!strCmd.empty()) {
boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex());
boost::thread t(runCommand, strCmd); // thread runs free boost::thread t(runCommand, strCmd); // thread runs free
}
} }
static bool fHaveGenesis = false; static bool fHaveGenesis = false;

2
src/wallet/wallet.cpp

@ -988,7 +988,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
// notify an external script when a wallet transaction comes in or is updated // notify an external script when a wallet transaction comes in or is updated
std::string strCmd = gArgs.GetArg("-walletnotify", ""); std::string strCmd = gArgs.GetArg("-walletnotify", "");
if ( !strCmd.empty()) if (!strCmd.empty())
{ {
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex()); boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
boost::thread t(runCommand, strCmd); // thread runs free boost::thread t(runCommand, strCmd); // thread runs free

Loading…
Cancel
Save