Changeset View
Changeset View
Standalone View
Standalone View
src/coins.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | CCoinsViewCursor *CCoinsView::Cursor() const { | ||||
return 0; | return 0; | ||||
} | } | ||||
CCoinsViewBacked::CCoinsViewBacked(CCoinsView *viewIn) : base(viewIn) {} | CCoinsViewBacked::CCoinsViewBacked(CCoinsView *viewIn) : base(viewIn) {} | ||||
bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) const { | bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) const { | ||||
return base->GetCoins(txid, coins); | return base->GetCoins(txid, coins); | ||||
} | } | ||||
bool CCoinsViewBacked::HaveCoins(const uint256 &txid) const { | bool CCoinsViewBacked::HaveCoins(const uint256 &txid) const { | ||||
return base->HaveCoins(txid); | return base->HaveCoins_DONOTUSE(txid); | ||||
} | } | ||||
uint256 CCoinsViewBacked::GetBestBlock() const { | uint256 CCoinsViewBacked::GetBestBlock() const { | ||||
return base->GetBestBlock(); | return base->GetBestBlock(); | ||||
} | } | ||||
void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { | void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { | ||||
base = &viewIn; | base = &viewIn; | ||||
} | } | ||||
bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins, | bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins, | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | bool CCoinsViewCache::HaveCoins(const uint256 &txid) const { | ||||
CCoinsMap::const_iterator it = FetchCoins(txid); | CCoinsMap::const_iterator it = FetchCoins(txid); | ||||
// We're using vtx.empty() instead of IsPruned here for performance reasons, | // We're using vtx.empty() instead of IsPruned here for performance reasons, | ||||
// as we only care about the case where a transaction was replaced entirely | // as we only care about the case where a transaction was replaced entirely | ||||
// in a reorganization (which wipes vout entirely, as opposed to spending | // in a reorganization (which wipes vout entirely, as opposed to spending | ||||
// which just cleans individual outputs). | // which just cleans individual outputs). | ||||
return (it != cacheCoins.end() && !it->second.coins.vout.empty()); | return (it != cacheCoins.end() && !it->second.coins.vout.empty()); | ||||
} | } | ||||
bool CCoinsViewCache::HaveCoinsInCache(const uint256 &txid) const { | bool CCoinsViewCache::HaveCoinInCache(const COutPoint &outpoint) const { | ||||
CCoinsMap::const_iterator it = cacheCoins.find(txid); | CCoinsMap::const_iterator it = cacheCoins.find(outpoint.hash); | ||||
return it != cacheCoins.end(); | return it != cacheCoins.end() && it->second.coins.IsAvailable(outpoint.n); | ||||
} | } | ||||
uint256 CCoinsViewCache::GetBestBlock() const { | uint256 CCoinsViewCache::GetBestBlock() const { | ||||
if (hashBlock.IsNull()) hashBlock = base->GetBestBlock(); | if (hashBlock.IsNull()) hashBlock = base->GetBestBlock(); | ||||
return hashBlock; | return hashBlock; | ||||
} | } | ||||
void CCoinsViewCache::SetBestBlock(const uint256 &hashBlockIn) { | void CCoinsViewCache::SetBestBlock(const uint256 &hashBlockIn) { | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |