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

Method FetchCoin

src/coins.cpp:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint &outpoint) const {
41 CCoinsMap::iterator it = cacheCoins.find(outpoint);
42 if (it != cacheCoins.end())
43 return it;
44 Coin tmp;
45 if (!base->GetCoin(outpoint, tmp))
46 return cacheCoins.end();
47 CCoinsMap::iterator ret = cacheCoins.emplace(std::piecewise_construct, std::forward_as_tuple(outpoint), std::forward_as_tuple(std::move(tmp))).first;
48 if (ret->second.coin.IsSpent()) {
49 // The parent only has an empty entry for this outpoint; we can consider our
50 // version as fresh.
51 ret->second.flags = CCoinsCacheEntry::FRESH;
52 }
53 cachedCoinsUsage += ret->second.coin.DynamicMemoryUsage();
54 return ret;
55}
56
57bool CCoinsViewCache::GetCoin(const COutPoint &outpoint, Coin &coin) const {
58 CCoinsMap::const_iterator it = FetchCoin(outpoint);

Callers

nothing calls this directly

Calls 5

findMethod · 0.45
endMethod · 0.45
GetCoinMethod · 0.45
IsSpentMethod · 0.45
DynamicMemoryUsageMethod · 0.45

Tested by

no test coverage detected