mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-13 17:18:00 +02:00
coins: add PeekCoin()
Introduce a helper to look up a Coin through a stack of CCoinsViewCache layers without populating parent caches. This is useful for ephemeral views (e.g. during ConnectBlock) that want to avoid polluting CoinsTip() when validating invalid blocks. Co-authored-by: l0rinc <pap.lorinc@gmail.com> Co-authored-by: Pieter Wuille <pieter@wuille.net> Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
@@ -257,7 +257,9 @@ FUZZ_TARGET(coinscache_sim)
|
||||
// Look up in simulation data.
|
||||
auto sim = lookup(outpointidx);
|
||||
// Look up in real caches.
|
||||
auto realcoin = caches.back()->GetCoin(data.outpoints[outpointidx]);
|
||||
auto realcoin = provider.ConsumeBool() ?
|
||||
caches.back()->PeekCoin(data.outpoints[outpointidx]) :
|
||||
caches.back()->GetCoin(data.outpoints[outpointidx]);
|
||||
// Compare results.
|
||||
if (!sim.has_value()) {
|
||||
assert(!realcoin);
|
||||
|
||||
Reference in New Issue
Block a user