MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / FetchCoins

Method FetchCoins

src/coins.cpp:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72CCoinsMap::const_iterator CCoinsViewCache::FetchCoins(const uint256 &txid) const {
73 CCoinsMap::iterator it = cacheCoins.find(txid);
74 if (it != cacheCoins.end())
75 return it;
76 CCoins tmp;
77 if (!base->GetCoins(txid, tmp))
78 return cacheCoins.end();
79 CCoinsMap::iterator ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry())).first;
80 tmp.swap(ret->second.coins);
81 if (ret->second.coins.IsPruned()) {
82 // The parent only has an empty entry for this txid; we can consider our
83 // version as fresh.
84 ret->second.flags = CCoinsCacheEntry::FRESH;
85 }
86 cachedCoinsUsage += ret->second.coins.DynamicMemoryUsage();
87 return ret;
88}
89
90bool CCoinsViewCache::GetCoins(const uint256 &txid, CCoins &coins) const {
91 CCoinsMap::const_iterator it = FetchCoins(txid);

Callers

nothing calls this directly

Calls 8

CCoinsCacheEntryClass · 0.85
findMethod · 0.80
IsPrunedMethod · 0.80
endMethod · 0.45
GetCoinsMethod · 0.45
insertMethod · 0.45
swapMethod · 0.45
DynamicMemoryUsageMethod · 0.45

Tested by

no test coverage detected