Changeset View
Changeset View
Standalone View
Standalone View
src/coins.cpp
Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | if (it != cacheCoins.end() && it->second.flags == 0) { | ||||
cacheCoins.erase(it); | cacheCoins.erase(it); | ||||
} | } | ||||
} | } | ||||
unsigned int CCoinsViewCache::GetCacheSize() const { | unsigned int CCoinsViewCache::GetCacheSize() const { | ||||
return cacheCoins.size(); | return cacheCoins.size(); | ||||
} | } | ||||
Amount CCoinsViewCache::GetValueIn(const CTransaction &tx) const { | |||||
if (tx.IsCoinBase()) { | |||||
return Amount::zero(); | |||||
} | |||||
Amount nResult = Amount::zero(); | |||||
for (size_t i = 0; i < tx.vin.size(); i++) { | |||||
nResult += AccessCoin(tx.vin[i].prevout).GetTxOut().nValue; | |||||
} | |||||
return nResult; | |||||
} | |||||
bool CCoinsViewCache::HaveInputs(const CTransaction &tx) const { | bool CCoinsViewCache::HaveInputs(const CTransaction &tx) const { | ||||
if (tx.IsCoinBase()) { | if (tx.IsCoinBase()) { | ||||
return true; | return true; | ||||
} | } | ||||
for (size_t i = 0; i < tx.vin.size(); i++) { | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
if (!HaveCoin(tx.vin[i].prevout)) { | if (!HaveCoin(tx.vin[i].prevout)) { | ||||
return false; | return false; | ||||
Show All 38 Lines |