This commit is contained in:
maflcko 2025-01-08 20:42:43 +01:00 committed by GitHub
commit 5d53537b44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
// Copyright (c) 2023 The Bitcoin Core developers
// Copyright (c) 2023-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -57,9 +57,9 @@ void initialize_tx_pool()
}
struct OutpointsUpdater final : public CValidationInterface {
std::set<COutPoint>& m_mempool_outpoints;
std::unordered_set<COutPoint, SaltedOutpointHasher>& m_mempool_outpoints;
explicit OutpointsUpdater(std::set<COutPoint>& r)
explicit OutpointsUpdater(std::unordered_set<COutPoint, SaltedOutpointHasher>& r)
: m_mempool_outpoints{r} {}
void TransactionAddedToMempool(const NewMempoolTransactionInfo& tx, uint64_t /* mempool_sequence */) override
@ -200,8 +200,8 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
MockTime(fuzzed_data_provider, chainstate);
// All RBF-spendable outpoints outside of the unsubmitted package
std::set<COutPoint> mempool_outpoints;
std::map<COutPoint, CAmount> outpoints_value;
std::unordered_set<COutPoint, SaltedOutpointHasher> mempool_outpoints;
std::unordered_map<COutPoint, CAmount, SaltedOutpointHasher> outpoints_value;
for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
Assert(mempool_outpoints.insert(outpoint).second);
outpoints_value[outpoint] = 50 * COIN;
@ -225,9 +225,9 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
std::optional<COutPoint> outpoint_to_rbf{fuzzed_data_provider.ConsumeBool() ? GetChildEvictingPrevout(tx_pool) : std::nullopt};
// Make small packages
const auto num_txs = outpoint_to_rbf ? 1 : (size_t) fuzzed_data_provider.ConsumeIntegralInRange<int>(1, 4);
const auto num_txs = outpoint_to_rbf ? 1 : fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 4);
std::set<COutPoint> package_outpoints;
std::unordered_set<COutPoint, SaltedOutpointHasher> package_outpoints;
while (txs.size() < num_txs) {
// Create transaction to add to the mempool
txs.emplace_back([&] {
@ -355,8 +355,8 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
MockTime(fuzzed_data_provider, chainstate);
// All RBF-spendable outpoints outside of the unsubmitted package
std::set<COutPoint> mempool_outpoints;
std::map<COutPoint, CAmount> outpoints_value;
std::unordered_set<COutPoint, SaltedOutpointHasher> mempool_outpoints;
std::unordered_map<COutPoint, CAmount, SaltedOutpointHasher> outpoints_value;
for (const auto& outpoint : g_outpoints_coinbase_init_mature) {
Assert(mempool_outpoints.insert(outpoint).second);
outpoints_value[outpoint] = 50 * COIN;
@ -377,8 +377,8 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
std::vector<CTransactionRef> txs;
// Make packages of 1-to-26 transactions
const auto num_txs = (size_t) fuzzed_data_provider.ConsumeIntegralInRange<int>(1, 26);
std::set<COutPoint> package_outpoints;
const auto num_txs = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 26);
std::unordered_set<COutPoint, SaltedOutpointHasher> package_outpoints;
while (txs.size() < num_txs) {
// Create transaction to add to the mempool
txs.emplace_back([&] {