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

Function WriteCoinsViewEntry

src/test/coins_tests.cpp:656–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654}
655
656static void WriteCoinsViewEntry(CCoinsView& view, const MaybeCoin& cache_coin)
657{
658 CoinsCachePair sentinel{};
659 sentinel.second.SelfRef(sentinel);
660 CCoinsMapMemoryResource resource;
661 CCoinsMap map{0, CCoinsMap::hasher{}, CCoinsMap::key_equal{}, &resource};
662 if (cache_coin) InsertCoinsMapEntry(map, sentinel, *cache_coin);
663 size_t dirty_count{cache_coin && cache_coin->IsDirty()};
664 auto cursor{CoinsViewCacheCursor(dirty_count, sentinel, map, /*will_erase=*/true)};
665 view.BatchWrite(cursor, {});
666 BOOST_CHECK_EQUAL(dirty_count, 0U);
667}
668
669class SingleEntryCacheTest
670{

Callers 2

SingleEntryCacheTestMethod · 0.85
CheckWriteCoinsFunction · 0.85

Calls 5

InsertCoinsMapEntryFunction · 0.85
SelfRefMethod · 0.80
IsDirtyMethod · 0.45
BatchWriteMethod · 0.45

Tested by

no test coverage detected