aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
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 */