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

Function PopulateView

src/test/coinsviewoverlay_tests.cpp:42–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void PopulateView(const CBlock& block, CCoinsView& view, bool spent = false)
43{
44 CCoinsViewCache cache{&view};
45 cache.SetBestBlock(uint256::ONE);
46
47 for (const auto& tx : block.vtx | std::views::drop(1)) {
48 for (const auto& in : tx->vin) {
49 Coin coin{};
50 if (!spent) coin.out.nValue = 1;
51 cache.EmplaceCoinInternalDANGER(COutPoint{in.prevout}, std::move(coin));
52 }
53 }
54
55 cache.Flush();
56}
57
58void CheckCache(const CBlock& block, const CCoinsViewCache& cache)
59{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

SetBestBlockMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected