mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
Allow moving CTxMemPoolEntry objects, disallow copying
This commit is contained in:
@@ -71,10 +71,7 @@ public:
|
||||
typedef std::set<CTxMemPoolEntryRef, CompareIteratorByHash> Children;
|
||||
|
||||
private:
|
||||
CTxMemPoolEntry(const CTxMemPoolEntry&) = default;
|
||||
struct ExplicitCopyTag {
|
||||
explicit ExplicitCopyTag() = default;
|
||||
};
|
||||
CTxMemPoolEntry(const CTxMemPoolEntry&) = delete;
|
||||
|
||||
const CTransactionRef tx;
|
||||
mutable Parents m_parents;
|
||||
@@ -127,13 +124,10 @@ public:
|
||||
nModFeesWithAncestors{nFee},
|
||||
nSigOpCostWithAncestors{sigOpCost} {}
|
||||
|
||||
CTxMemPoolEntry(ExplicitCopyTag, const CTxMemPoolEntry& entry) : CTxMemPoolEntry(entry) {}
|
||||
CTxMemPoolEntry& operator=(const CTxMemPoolEntry&) = delete;
|
||||
CTxMemPoolEntry(CTxMemPoolEntry&&) = delete;
|
||||
CTxMemPoolEntry(CTxMemPoolEntry&&) = default;
|
||||
CTxMemPoolEntry& operator=(CTxMemPoolEntry&&) = delete;
|
||||
|
||||
static constexpr ExplicitCopyTag ExplicitCopy{};
|
||||
|
||||
const CTransaction& GetTx() const { return *this->tx; }
|
||||
CTransactionRef GetSharedTx() const { return this->tx; }
|
||||
const CAmount& GetFee() const { return nFee; }
|
||||
|
||||
@@ -74,7 +74,7 @@ FUZZ_TARGET(policy_estimator, .init = initialize_policy_estimator)
|
||||
break;
|
||||
}
|
||||
const CTransaction tx{*mtx};
|
||||
mempool_entries.emplace_back(CTxMemPoolEntry::ExplicitCopy, ConsumeTxMemPoolEntry(fuzzed_data_provider, tx, current_height));
|
||||
mempool_entries.push_back(ConsumeTxMemPoolEntry(fuzzed_data_provider, tx, current_height));
|
||||
}
|
||||
std::vector<RemovedMempoolTransactionInfo> txs;
|
||||
txs.reserve(mempool_entries.size());
|
||||
|
||||
Reference in New Issue
Block a user