aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorglozow <gzhao408@berkeley.edu>2021-05-10 09:30:14 -0700
committerglozow <gzhao408@berkeley.edu>2021-05-20 21:34:31 +0100
commit897e348f5987eadd8559981a973c045c471b3ad8 (patch)
tree945a1f4e40e229d19b74db6029441ad8a055fa1b /src/txmempool.h
parent42cf8b25df07c45562b7210e0e15c3fd5edb2c11 (diff)
downloadbitcoin-897e348f5987eadd8559981a973c045c471b3ad8.tar.xz
[coins/mempool] extend CCoinsViewMemPool to track temporary coins
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index c3a9bd851d..ca856a5abc 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -852,7 +852,8 @@ public:
* CCoinsView that brings transactions from a mempool 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!
+ * base CCoinsView, are outputs from any mempool transaction, or are
+ * tracked temporarily to allow transaction dependencies in package validation.
* 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.
@@ -862,12 +863,19 @@ public:
*/
class CCoinsViewMemPool : public CCoinsViewBacked
{
+ /**
+ * Coins made available by transactions being validated. Tracking these allows for package
+ * validation, since we can access transaction outputs without submitting them to mempool.
+ */
+ std::unordered_map<COutPoint, Coin, SaltedOutpointHasher> m_temp_added;
protected:
const CTxMemPool& mempool;
public:
CCoinsViewMemPool(CCoinsView* baseIn, const CTxMemPool& mempoolIn);
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override;
+ /** Add the coins created by this transaction. */
+ void PackageAddTransaction(const CTransactionRef& tx);
};
/**