MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CheckCache

Function CheckCache

src/test/coinsviewoverlay_tests.cpp:58–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void CheckCache(const CBlock& block, const CCoinsViewCache& cache)
59{
60 uint32_t counter{0};
61
62 for (const auto& tx : block.vtx) {
63 if (tx->IsCoinBase()) {
64 BOOST_CHECK(!cache.HaveCoinInCache(tx->vin[0].prevout));
65 } else {
66 for (const auto& in : tx->vin) {
67 const auto& outpoint{in.prevout};
68 const auto& first{cache.AccessCoin(outpoint)};
69 const auto& second{cache.AccessCoin(outpoint)};
70 BOOST_CHECK_EQUAL(&first, &second);
71 ++counter;
72 BOOST_CHECK(cache.HaveCoinInCache(outpoint));
73 }
74 }
75 }
76 BOOST_CHECK_EQUAL(cache.GetCacheSize(), counter);
77}
78
79} // namespace
80

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

HaveCoinInCacheMethod · 0.80
GetCacheSizeMethod · 0.80
IsCoinBaseMethod · 0.45

Tested by

no test coverage detected