| 45 | } |
| 46 | |
| 47 | CCoinsMap::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 | |
| 62 | std::optional<Coin> CCoinsViewCache::GetCoin(const COutPoint& outpoint) const |
| 63 | { |
nothing calls this directly
no test coverage detected