| 38 | } |
| 39 | |
| 40 | CCoinsMap::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 | |
| 57 | bool CCoinsViewCache::GetCoin(const COutPoint &outpoint, Coin &coin) const { |
| 58 | CCoinsMap::const_iterator it = FetchCoin(outpoint); |
nothing calls this directly
no test coverage detected