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

Method FetchCoin

src/coins.cpp:47–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint &outpoint) const {
48 const auto [ret, inserted] = cacheCoins.try_emplace(outpoint);
49 if (inserted) {
50 if (auto coin{FetchCoinFromBase(outpoint)}) {
51 ret->second.coin = std::move(*coin);
52 cachedCoinsUsage += ret->second.coin.DynamicMemoryUsage();
53 Assert(!ret->second.coin.IsSpent());
54 } else {
55 cacheCoins.erase(ret);
56 return cacheCoins.end();
57 }
58 }
59 return ret;
60}
61
62std::optional<Coin> CCoinsViewCache::GetCoin(const COutPoint& outpoint) const
63{

Callers

nothing calls this directly

Calls 4

DynamicMemoryUsageMethod · 0.45
IsSpentMethod · 0.45
eraseMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected