aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-02-15 08:56:55 -0500
committerGavin Andresen <gavinandresen@gmail.com>2014-02-15 08:56:55 -0500
commit085c62149ad19cecf235829e49df07884a279e1e (patch)
tree4106ba96196e883464f5891ef88be34514c67cb9 /src/wallet.h
parent05d3ded072d782036c31c1d773c0441b87de843e (diff)
parent731b89b8b53cb2ea4d2d5c8f2875def515766ea1 (diff)
Merge pull request #3671 from gavinandresen/txn_conflicts
Report transaction conflicts, and tentative account balance fix
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wallet.h b/src/wallet.h
index dc709632b4..95fb0ee9de 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -108,6 +108,12 @@ private:
int64_t nNextResend;
int64_t nLastResend;
+ // Used to detect and report conflicted transactions:
+ typedef std::multimap<COutPoint, uint256> TxConflicts;
+ TxConflicts mapTxConflicts;
+ void AddToConflicts(const uint256& wtxhash);
+ void SyncMetaData(std::pair<TxConflicts::iterator, TxConflicts::iterator>);
+
public:
/// Main wallet lock.
/// This lock protects all the fields added by CWallet
@@ -151,6 +157,7 @@ public:
}
std::map<uint256, CWalletTx> mapWallet;
+
int64_t nOrderPosNext;
std::map<uint256, int> mapRequestCount;
@@ -223,7 +230,7 @@ public:
TxItems OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount = "");
void MarkDirty();
- bool AddToWallet(const CWalletTx& wtxIn);
+ bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet=false);
void SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock);
bool AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate);
void EraseFromWallet(const uint256 &hash);
@@ -358,6 +365,9 @@ public:
// get the current wallet format (the oldest client version guaranteed to understand this wallet)
int GetVersion() { AssertLockHeld(cs_wallet); return nWalletVersion; }
+ // Get wallet transactions that conflict with given transaction (spend same outputs)
+ std::set<uint256> GetConflicts(const uint256& txid) const;
+
/** Address book entry changed.
* @note called with lock cs_wallet held.
*/
@@ -753,6 +763,8 @@ public:
void AddSupportingTransactions();
bool AcceptWalletTransaction();
void RelayWalletTransaction();
+
+ std::set<uint256> GetConflicts() const;
};