aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-11-11 17:35:14 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-11-30 15:42:10 +1000
commit4d707d512070ed88c888fdf625c0ae0f85f68d9b (patch)
tree2fe293e6b06acff639d8c1361fe1c0725313dd30 /src/txmempool.h
parent0733c1bde69c6ccfe593d2eec775d0ae32fe7140 (diff)
downloadbitcoin-4d707d512070ed88c888fdf625c0ae0f85f68d9b.tar.xz
Add verbose boolean to getrawmempool
Also changes mempool to store CTxMemPoolEntries to keep track of when they enter/exit the pool.
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index 57b92789fb..a652c424a4 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -13,6 +13,33 @@
static const unsigned int MEMPOOL_HEIGHT = 0x7FFFFFFF;
/*
+ * CTxMemPool stores these:
+ */
+class CTxMemPoolEntry
+{
+private:
+ CTransaction tx;
+ int64_t nFee; // Cached to avoid expensive parent-transaction lookups
+ size_t nTxSize; // ... and avoid recomputing tx size
+ int64_t nTime; // Local time when entering the mempool
+ double dPriority; // Priority when entering the mempool
+ unsigned int nHeight; // Chain height when entering the mempool
+
+public:
+ CTxMemPoolEntry(const CTransaction& _tx, int64_t _nFee,
+ int64_t _nTime, double _dPriority, unsigned int _nHeight);
+ CTxMemPoolEntry();
+ CTxMemPoolEntry(const CTxMemPoolEntry& other);
+
+ const CTransaction& GetTx() const { return this->tx; }
+ double GetPriority(unsigned int currentHeight) const;
+ int64_t GetFee() const { return nFee; }
+ size_t GetTxSize() const { return nTxSize; }
+ int64_t GetTime() const { return nTime; }
+ unsigned int GetHeight() const { return nHeight; }
+};
+
+/*
* CTxMemPool stores valid-according-to-the-current-best-chain
* transactions that may be included in the next block.
*
@@ -30,7 +57,7 @@ private:
public:
mutable CCriticalSection cs;
- std::map<uint256, CTransaction> mapTx;
+ std::map<uint256, CTxMemPoolEntry> mapTx;
std::map<COutPoint, CInPoint> mapNextTx;
CTxMemPool();
@@ -44,7 +71,7 @@ public:
void check(CCoinsViewCache *pcoins) const;
void setSanityCheck(bool _fSanityCheck) { fSanityCheck = _fSanityCheck; }
- bool addUnchecked(const uint256& hash, const CTransaction &tx);
+ bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry);
bool remove(const CTransaction &tx, bool fRecursive = false);
bool removeConflicts(const CTransaction &tx);
void clear();