| 107 | } |
| 108 | |
| 109 | CCoinsMap::const_iterator CCoinsViewCache::FetchCoins(const uint256& txid) const |
| 110 | { |
| 111 | CCoinsMap::iterator it = cacheCoins.find(txid); |
| 112 | if (it != cacheCoins.end()) |
| 113 | return it; |
| 114 | CCoins tmp; |
| 115 | if (!base->GetCoins(txid, tmp)) |
| 116 | return cacheCoins.end(); |
| 117 | CCoinsMap::iterator ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry())).first; |
| 118 | tmp.swap(ret->second.coins); |
| 119 | if (ret->second.coins.IsPruned()) { |
| 120 | // The parent only has an empty entry for this txid; we can consider our |
| 121 | // version as fresh. |
| 122 | ret->second.flags = CCoinsCacheEntry::FRESH; |
| 123 | } |
| 124 | cachedCoinsUsage += ret->second.coins.DynamicMemoryUsage(); |
| 125 | return ret; |
| 126 | } |
| 127 | |
| 128 | bool CCoinsViewCache::GetCoins(const uint256& txid, CCoins& coins) const |
| 129 | { |
nothing calls this directly
no test coverage detected