Merge pull request #19 from lateminer/ui-respendalert

UI to alert of respend attempt affecting wallet.
This commit is contained in:
janko33bd
2018-01-09 21:34:03 +01:00
committed by GitHub
9 changed files with 74 additions and 14 deletions

View File

@@ -1196,6 +1196,20 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
// Notify UI of new or updated transaction
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
// Notifications for existing transactions that now have conflicts with this one
if (fInsertedNew)
{
BOOST_FOREACH(const uint256& conflictHash, wtxIn.GetConflicts())
{
CWalletTx& txConflict = mapWallet[conflictHash];
NotifyTransactionChanged(this, conflictHash, CT_UPDATED); //Updates UI table
if (IsFromMe(txConflict) || IsMine(txConflict))
{
NotifyTransactionChanged(this, conflictHash, CT_GOT_CONFLICT); //Throws dialog
}
}
}
// notify an external script when a wallet transaction comes in or is updated
std::string strCmd = GetArg("-walletnotify", "");

View File

@@ -535,6 +535,9 @@ public:
MasterKeyMap mapMasterKeys;
unsigned int nMasterKeyMaxID;
// Increment to cause UI refresh, similar to new block
int64_t nConflictsReceived;
CWallet()
{
SetNull();
@@ -566,6 +569,7 @@ public:
nLastResend = 0;
nTimeFirstKey = 0;
fBroadcastTransactions = false;
nConflictsReceived = 0;
}
std::map<uint256, CWalletTx> mapWallet;