X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.cpp;h=7ddd67f9a6bb9fc5320f667e8a38cea548ff61ab;hb=77eabaa6e041aa8bfb0f5fc824811cff7abdfadf;hp=64e3318b041074d03f676ca0f8a3afa89e1d8db3;hpb=dfd0524d74a0970a7cbcc110b3c1b42e89deb32f;p=novacoin.git diff --git a/src/wallet.cpp b/src/wallet.cpp index 64e3318..7ddd67f 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -9,6 +9,7 @@ #include "ui_interface.h" #include "base58.h" #include "kernel.h" +#include using namespace std; extern int nStakeMaxAge; @@ -501,6 +502,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; } @@ -975,7 +986,7 @@ int64 CWallet::GetBalance() const for (map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (pcoin->IsFinal() && pcoin->IsConfirmed()) + if (pcoin->IsConfirmed()) nTotal += pcoin->GetAvailableCredit(); } }