Move CCoins-related logic to coins.{cpp.h}
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user