mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge pull request #1974 from kjj2/walletnotify
Add -walletnotify to call an external script on wallet transactions
This commit is contained in:
commit
49e332f6fc
2 changed files with 12 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "crypter.h"
|
||||
#include "ui_interface.h"
|
||||
#include "base58.h"
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -476,6 +477,16 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
|
|||
|
||||
// Notify UI of new or updated transaction
|
||||
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
|
||||
|
||||
// notify an external script when a wallet transaction comes in or is updated
|
||||
std::string strCmd = GetArg("-walletnotify", "");
|
||||
|
||||
if ( !strCmd.empty())
|
||||
{
|
||||
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
|
||||
boost::thread t(runCommand, strCmd); // thread runs free
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue