aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/mini_miner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fuzz/mini_miner.cpp')
-rw-r--r--src/test/fuzz/mini_miner.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/fuzz/mini_miner.cpp b/src/test/fuzz/mini_miner.cpp
index f49d940393..2b371f6d5f 100644
--- a/src/test/fuzz/mini_miner.cpp
+++ b/src/test/fuzz/mini_miner.cpp
@@ -118,10 +118,11 @@ FUZZ_TARGET_INIT(mini_miner_selection, initialize_miner)
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100)
{
CMutableTransaction mtx = CMutableTransaction();
- const size_t num_inputs = 2;
+ assert(!available_coins.empty());
+ const size_t num_inputs = std::min(size_t{2}, available_coins.size());
const size_t num_outputs = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(2, 5);
for (size_t n{0}; n < num_inputs; ++n) {
- auto prevout = available_coins.front();
+ auto prevout = available_coins.at(0);
mtx.vin.push_back(CTxIn(prevout, CScript()));
available_coins.pop_front();
}