aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
authorTom Harding <tomh@thinlink.com>2014-06-26 18:31:05 -0700
committerTom Harding <tomh@thinlink.com>2014-06-27 07:54:21 -0700
commitada5a067c75f19a724cc054286ecf2254e5dbe8f (patch)
treedcbb99b8eb6dcce4c9ab8eae70f9a4923ca5f664 /src/wallet.h
parentd640a3ceab4f4372c2a0f738c1286cfde4b41b50 (diff)
downloadbitcoin-ada5a067c75f19a724cc054286ecf2254e5dbe8f.tar.xz
UI to alert of respend attempt affecting wallet.
Respend transactions that conflict with transactions already in the wallet are added to it. They are not displayed unless they also involve the wallet, or get into a block. If they do not involve the wallet, they continue not to affect balance. Transactions that involve the wallet, and have conflicting non-equivalent transactions, are highlighted in red. When the conflict first occurs, a modal dialog is thrown. CWallet::SyncMetaData is changed to sync only to equivalent transactions. When a conflict is added to the wallet, counter nConflictsReceived is incremented. This acts like a change in active block height for the purpose of triggering UI updates.
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/wallet.h b/src/wallet.h
index 8494ce9a34..1c2512d678 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -141,6 +141,9 @@ public:
MasterKeyMap mapMasterKeys;
unsigned int nMasterKeyMaxID;
+ // Increment to cause UI refresh, similar to new block
+ int64_t nConflictsReceived;
+
CWallet()
{
SetNull();
@@ -163,6 +166,7 @@ public:
nNextResend = 0;
nLastResend = 0;
nTimeFirstKey = 0;
+ nConflictsReceived = 0;
}
std::map<uint256, CWalletTx> mapWallet;
@@ -305,6 +309,13 @@ public:
{
return (GetDebit(tx) > 0);
}
+ bool IsConflicting(const CTransaction& tx) const
+ {
+ BOOST_FOREACH(const CTxIn& txin, tx.vin)
+ if (mapTxSpends.count(txin.prevout))
+ return true;
+ return false;
+ }
int64_t GetDebit(const CTransaction& tx) const
{
int64_t nDebit = 0;
@@ -377,7 +388,7 @@ public:
int GetVersion() { LOCK(cs_wallet); return nWalletVersion; }
// Get wallet transactions that conflict with given transaction (spend same outputs)
- std::set<uint256> GetConflicts(const uint256& txid) const;
+ std::set<uint256> GetConflicts(const uint256& txid, bool includeEquivalent) const;
/** Address book entry changed.
* @note called with lock cs_wallet held.
@@ -699,7 +710,7 @@ public:
void RelayWalletTransaction();
- std::set<uint256> GetConflicts() const;
+ std::set<uint256> GetConflicts(bool includeEquivalent=true) const;
};