mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 17:56:16 +00:00
fuzz: call EmplaceCoinInternalDANGER as well in SimulationTest
Adds test coverage by randomly calling `EmplaceCoinInternalDANGER` in `SimulationTest` to verify it remains correct as we modify it in a future commit. Co-authored-by: Andrew Toth <andrewstoth@gmail.com>
This commit is contained in:
parent
8f0e1f6540
commit
7e52b1b945
@ -189,8 +189,11 @@ void SimulationTest(CCoinsView* base, bool fake_best_block)
|
||||
(coin.IsSpent() ? added_an_entry : updated_an_entry) = true;
|
||||
coin = newcoin;
|
||||
}
|
||||
bool is_overwrite = !coin.IsSpent() || m_rng.rand32() & 1;
|
||||
stack.back()->AddCoin(COutPoint(txid, 0), std::move(newcoin), is_overwrite);
|
||||
if (COutPoint op(txid, 0); !stack.back()->map().contains(op) && !newcoin.out.scriptPubKey.IsUnspendable() && m_rng.randbool()) {
|
||||
stack.back()->EmplaceCoinInternalDANGER(std::move(op), std::move(newcoin));
|
||||
} else {
|
||||
stack.back()->AddCoin(op, std::move(newcoin), /*possible_overwrite=*/!coin.IsSpent() || m_rng.randbool());
|
||||
}
|
||||
} else {
|
||||
// Spend the coin.
|
||||
removed_an_entry = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user