aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-11-05 02:47:07 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2013-11-10 19:37:56 +0100
commita0fa20a12b69717636050dd8742713b1d82ae524 (patch)
treed1db4dc173a9f4d24904a1636f5cf82cd3c1c737 /src/txmempool.h
parent84674082b0c4cfcdd54fb97a29bc841aa7f691c2 (diff)
Move CCoins-related logic to coins.{cpp.h}
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index d5a7832ff7..57b92789fb 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -5,9 +5,13 @@
#ifndef BITCOIN_TXMEMPOOL_H
#define BITCOIN_TXMEMPOOL_H
+#include "coins.h"
#include "core.h"
#include "sync.h"
+/** Fake height value used in CCoins to signify they are only in the memory pool (since 0.8) */
+static const unsigned int MEMPOOL_HEIGHT = 0x7FFFFFFF;
+
/*
* CTxMemPool stores valid-according-to-the-current-best-chain
* transactions that may be included in the next block.
@@ -37,8 +41,7 @@ public:
* all inputs are in the mapNextTx array). If sanity-checking is turned off,
* check does nothing.
*/
- typedef CCoins& (*CoinLookupFunc)(const uint256&);
- void check(CoinLookupFunc fnLookup) const;
+ void check(CCoinsViewCache *pcoins) const;
void setSanityCheck(bool _fSanityCheck) { fSanityCheck = _fSanityCheck; }
bool addUnchecked(const uint256& hash, const CTransaction &tx);
@@ -65,4 +68,17 @@ public:
bool lookup(uint256 hash, CTransaction& result) const;
};
+/** CCoinsView that brings transactions from a memorypool into view.
+ It does not check for spendings by memory pool transactions. */
+class CCoinsViewMemPool : public CCoinsViewBacked
+{
+protected:
+ CTxMemPool &mempool;
+
+public:
+ CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn);
+ bool GetCoins(const uint256 &txid, CCoins &coins);
+ bool HaveCoins(const uint256 &txid);
+};
+
#endif /* BITCOIN_TXMEMPOOL_H */