|
1 |
| -// Copyright (c) 2020-2022 The Bitcoin Core developers |
| 1 | +// Copyright (c) 2020-present The Bitcoin Core developers |
2 | 2 | // Distributed under the MIT software license, see the accompanying
|
3 | 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
4 | 4 |
|
@@ -108,31 +108,30 @@ FUZZ_TARGET(package_rbf, .init = initialize_package_rbf)
|
108 | 108 |
|
109 | 109 | // Add a bunch of parent-child pairs to the mempool, and remember them.
|
110 | 110 | std::vector<CTransaction> mempool_txs;
|
111 |
| - size_t iter{0}; |
| 111 | + uint32_t iter{0}; |
112 | 112 |
|
113 | 113 | // Keep track of the total vsize of CTxMemPoolEntry's being added to the mempool to avoid overflow
|
114 | 114 | // Add replacement_vsize since this is added to new diagram during RBF check
|
115 | 115 | std::optional<CMutableTransaction> replacement_tx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider, TX_WITH_WITNESS);
|
116 | 116 | if (!replacement_tx) {
|
117 | 117 | return;
|
118 | 118 | }
|
119 |
| - assert(iter <= g_outpoints.size()); |
120 | 119 | replacement_tx->vin.resize(1);
|
121 |
| - replacement_tx->vin[0].prevout = g_outpoints[iter++]; |
| 120 | + replacement_tx->vin[0].prevout = g_outpoints.at(iter++); |
122 | 121 | CTransaction replacement_tx_final{*replacement_tx};
|
123 | 122 | auto replacement_entry = ConsumeTxMemPoolEntry(fuzzed_data_provider, replacement_tx_final);
|
124 | 123 | int32_t replacement_vsize = replacement_entry.GetTxSize();
|
125 | 124 | int64_t running_vsize_total{replacement_vsize};
|
126 | 125 |
|
127 | 126 | LOCK2(cs_main, pool.cs);
|
128 | 127 |
|
129 |
| - LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), NUM_ITERS) |
130 |
| - { |
| 128 | + while (fuzzed_data_provider.ConsumeBool()) { |
| 129 | + if (iter >= NUM_ITERS) break; |
| 130 | + |
131 | 131 | // Make sure txns only have one input, and that a unique input is given to avoid circular references
|
132 | 132 | CMutableTransaction parent;
|
133 |
| - assert(iter <= g_outpoints.size()); |
134 | 133 | parent.vin.resize(1);
|
135 |
| - parent.vin[0].prevout = g_outpoints[iter++]; |
| 134 | + parent.vin[0].prevout = g_outpoints.at(iter++); |
136 | 135 | parent.vout.emplace_back(0, CScript());
|
137 | 136 |
|
138 | 137 | mempool_txs.emplace_back(parent);
|
|
0 commit comments