aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorkjj2 <github@jerviss.org>2012-11-03 09:58:41 -0500
committerkjj2 <github@jerviss.org>2012-11-03 10:07:57 -0500
commitcae686d31e18a68826ef61931ae8379fe9461d7b (patch)
tree4615748a180ad35155eeb01d5577dc35a2dcf924 /src/wallet.cpp
parent6cbae37667f504d9ecd6173e1eff817d2b7aaf0c (diff)
Add -walletnotify to call an external script on wallet transactions
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 880f7aa8bd..f9da100e21 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -8,6 +8,7 @@
#include "crypter.h"
#include "ui_interface.h"
#include "base58.h"
+#include <boost/algorithm/string/replace.hpp>
using namespace std;
@@ -470,6 +471,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;
}