diff options
Diffstat (limited to 'src/txmempool.h')
-rw-r--r-- | src/txmempool.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index 7ca3b18a1e..6723ea8e6c 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -45,7 +45,7 @@ struct LockPoints // values are still valid even after a reorg. CBlockIndex* maxInputBlock; - LockPoints() : height(0), time(0), maxInputBlock(NULL) { } + LockPoints() : height(0), time(0), maxInputBlock(nullptr) { } }; class CTxMemPool; @@ -592,7 +592,7 @@ public: * pvNoSpendsRemaining, if set, will be populated with the list of outpoints * which are not in mempool which no longer have any spends in this mempool. */ - void TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpendsRemaining=NULL); + void TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpendsRemaining=nullptr); /** Expire all transaction (and their dependencies) in the mempool older than time. Return the number of removed transactions. */ int Expire(int64_t time); @@ -618,13 +618,6 @@ public: return (mapTx.count(hash) != 0); } - bool exists(const COutPoint& outpoint) const - { - LOCK(cs); - auto it = mapTx.find(outpoint.hash); - return (it != mapTx.end() && outpoint.n < it->GetTx().vout.size()); - } - CTransactionRef get(const uint256& hash) const; TxMempoolInfo info(const uint256& hash) const; std::vector<TxMempoolInfo> infoAll() const; @@ -676,6 +669,13 @@ private: /** * CCoinsView that brings transactions from a memorypool into view. * It does not check for spendings by memory pool transactions. + * Instead, it provides access to all Coins which are either unspent in the + * base CCoinsView, or are outputs from any mempool transaction! + * This allows transaction replacement to work as expected, as you want to + * have all inputs "available" to check signatures, and any cycles in the + * dependency graph are checked directly in AcceptToMemoryPool. + * It also allows you to sign a double-spend directly in signrawtransaction, + * as long as the conflicting transaction is not yet confirmed. */ class CCoinsViewMemPool : public CCoinsViewBacked { @@ -684,8 +684,7 @@ protected: public: CCoinsViewMemPool(CCoinsView* baseIn, const CTxMemPool& mempoolIn); - bool GetCoin(const COutPoint &outpoint, Coin &coin) const; - bool HaveCoin(const COutPoint &outpoint) const; + bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; }; /** |