| 49 | } |
| 50 | |
| 51 | CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint &outpoint) const { |
| 52 | CCoinsMap::iterator it = cacheCoins.find(native_key(outpoint)); |
| 53 | if (it != cacheCoins.end()) |
| 54 | return it; |
| 55 | Coin tmp; |
| 56 | if (!base->GetCoin(outpoint, tmp)) |
| 57 | return cacheCoins.end(); |
| 58 | CCoinsMap::iterator ret = cacheCoins.emplace(std::piecewise_construct, |
| 59 | std::forward_as_tuple(native_key(outpoint)), |
| 60 | std::forward_as_tuple(std::move(tmp))).first; |
| 61 | if (ret->second.coin.IsSpent()) { |
| 62 | // The parent only has an empty entry for this outpoint; we can consider our |
| 63 | // version as fresh. |
| 64 | ret->second.flags = CCoinsCacheEntry::FRESH; |
| 65 | } |
| 66 | cachedCoinsUsage += ret->second.coin.DynamicMemoryUsage(); |
| 67 | return ret; |
| 68 | } |
| 69 | |
| 70 | bool CCoinsViewCache::GetCoin(const COutPoint &outpoint, Coin &coin) const { |
| 71 | CCoinsMap::const_iterator it = FetchCoin(outpoint); |
nothing calls this directly
no test coverage detected