Skip to content

Commit

Permalink
Add -newtxnotify
Browse files Browse the repository at this point in the history
  • Loading branch information
Tranz5 committed May 27, 2014
1 parent 4a99f9c commit 58dd3de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ std::string HelpMessage()
" -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" +
" -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
" -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" +
" -newtxnotify=<cmd> " + _("Execute command when a new wallet transaction occurs (%s in cmd is replaced by TxID)") + "\n" +
" -confchange " + _("Require a confirmations for change (default: 0)") + "\n" +
" -enforcecanonical " + _("Enforce transaction scripts to use canonical PUSH operators (default: 1)") + "\n" +
" -upgradewallet " + _("Upgrade wallet to latest format") + "\n" +
Expand Down
8 changes: 8 additions & 0 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,14 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
boost::thread t(runCommand, strCmd); // thread runs free
}

// notify an external script when a wallet transaction is received
std::string strCmdNewNotify = GetArg("-newtxnotify", "");
if ( !strCmdNewNotify.empty() && fInsertedNew)
{
boost::replace_all(strCmdNewNotify, "%s", wtxIn.GetHash().GetHex());
boost::thread t(runCommand, strCmdNewNotify); // thread runs free
}
}
return true;
}
Expand Down

0 comments on commit 58dd3de

Please sign in to comment.