diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 69965ed1b8c..461022bbfc5 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -344,6 +344,7 @@ test_fuzz_fuzz_SOURCES = \ test/fuzz/txorphan.cpp \ test/fuzz/txrequest.cpp \ test/fuzz/utxo_snapshot.cpp \ + test/fuzz/utxo_total_supply.cpp \ test/fuzz/validation_load_mempool.cpp \ test/fuzz/versionbits.cpp endif # ENABLE_FUZZ_BINARY diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp index 8dd4117a3ec..4d032cefc5f 100644 --- a/src/bench/block_assemble.cpp +++ b/src/bench/block_assemble.cpp @@ -27,7 +27,7 @@ static void AssembleBlock(benchmark::Bench& bench) std::array txs; for (size_t b{0}; b < NUM_BLOCKS; ++b) { CMutableTransaction tx; - tx.vin.push_back(MineBlock(test_setup->m_node, P2WSH_OP_TRUE)); + tx.vin.push_back(CTxIn{MineBlock(test_setup->m_node, P2WSH_OP_TRUE)}); tx.vin.back().scriptWitness = witness; tx.vout.emplace_back(1337, P2WSH_OP_TRUE); if (NUM_BLOCKS - b >= COINBASE_MATURITY) diff --git a/src/kernel/coinstats.cpp b/src/kernel/coinstats.cpp index 4b75c387a64..527433f45ef 100644 --- a/src/kernel/coinstats.cpp +++ b/src/kernel/coinstats.cpp @@ -123,7 +123,7 @@ static bool ComputeUTXOStats(CCoinsView* view, CCoinsStats& stats, T hash_obj, c uint256 prevkey; std::map outputs; while (pcursor->Valid()) { - interruption_point(); + if (interruption_point) interruption_point(); COutPoint key; Coin coin; if (pcursor->GetKey(key) && pcursor->GetValue(coin)) { diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp index a0557055754..b758c715efc 100644 --- a/src/test/fuzz/tx_pool.cpp +++ b/src/test/fuzz/tx_pool.cpp @@ -42,12 +42,12 @@ void initialize_tx_pool() g_setup = testing_setup.get(); for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) { - CTxIn in = MineBlock(g_setup->m_node, P2WSH_OP_TRUE); + COutPoint prevout{MineBlock(g_setup->m_node, P2WSH_OP_TRUE)}; // Remember the txids to avoid expensive disk access later on auto& outpoints = i < COINBASE_MATURITY ? g_outpoints_coinbase_init_mature : g_outpoints_coinbase_init_immature; - outpoints.push_back(in.prevout); + outpoints.push_back(prevout); } SyncWithValidationInterfaceQueue(); } diff --git a/src/test/fuzz/utxo_total_supply.cpp b/src/test/fuzz/utxo_total_supply.cpp new file mode 100644 index 00000000000..7813b7854b1 --- /dev/null +++ b/src/test/fuzz/utxo_total_supply.cpp @@ -0,0 +1,165 @@ +// Copyright (c) 2020 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include +#include +#include +#include