aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-04-17 20:12:48 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2012-04-17 20:12:48 +0200
commitc23617fef3086e0d11ccfa288afa1c1d177bcdc8 (patch)
tree1e73b39153c9fbed651b094906ff119fa3ba522a /src/main.h
parentcaeddc5d3738c95e0755560aa3d9b1f32e9fbce5 (diff)
parentca4c4c53a8b1417563c72da0aea626f111a7f25d (diff)
Merge remote-tracking branch 'jgarzik/mempool'
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/main.h b/src/main.h
index bcd62080d5..d12a3cc258 100644
--- a/src/main.h
+++ b/src/main.h
@@ -60,7 +60,6 @@ extern CBigNum bnBestChainWork;
extern CBigNum bnBestInvalidWork;
extern uint256 hashBestChain;
extern CBlockIndex* pindexBest;
-extern uint64 nPooledTx;
extern unsigned int nTransactionsUpdated;
extern uint64 nLastBlockTx;
extern uint64 nLastBlockSize;
@@ -682,9 +681,6 @@ public:
protected:
const CTxOut& GetOutputFor(const CTxIn& input, const MapPrevTx& inputs) const;
- bool AddToMemoryPoolUnchecked();
-public:
- bool RemoveFromMemoryPool();
};
@@ -1601,4 +1597,35 @@ public:
bool ProcessAlert();
};
+class CTxMemPool
+{
+public:
+ mutable CCriticalSection cs;
+ std::map<uint256, CTransaction> mapTx;
+ std::map<COutPoint, CInPoint> mapNextTx;
+
+ bool accept(CTxDB& txdb, CTransaction &tx,
+ bool fCheckInputs, bool* pfMissingInputs);
+ bool addUnchecked(CTransaction &tx);
+ bool remove(CTransaction &tx);
+
+ unsigned long size()
+ {
+ LOCK(cs);
+ return mapTx.size();
+ }
+
+ bool exists(uint256 hash)
+ {
+ return (mapTx.count(hash) != 0);
+ }
+
+ CTransaction& lookup(uint256 hash)
+ {
+ return mapTx[hash];
+ }
+};
+
+extern CTxMemPool mempool;
+
#endif