MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / SpendCoin

Method SpendCoin

src/coins.cpp:98–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
99 CCoinsMap::iterator it = FetchCoin(outpoint);
100 if (it == cacheCoins.end()) return false;
101 cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
102 if (moveout) {
103 *moveout = std::move(it->second.coin);
104 }
105 if (it->second.flags & CCoinsCacheEntry::FRESH) {
106 cacheCoins.erase(it);
107 } else {
108 it->second.flags |= CCoinsCacheEntry::DIRTY;
109 it->second.coin.Clear();
110 }
111 return true;
112}
113
114static const Coin coinEmpty;
115

Callers 5

UpdateCoinsFunction · 0.80
DisconnectBlockMethod · 0.80
RollforwardBlockMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
CheckSpendCoinsFunction · 0.80

Calls 4

endMethod · 0.45
DynamicMemoryUsageMethod · 0.45
eraseMethod · 0.45
ClearMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
CheckSpendCoinsFunction · 0.64