Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 1,021 Lines • ▼ Show 20 Lines | bool CCoinsViewMemPool::GetCoin(const COutPoint &outpoint, Coin &coin) const { | ||||
CTransactionRef ptx = mempool.get(outpoint.GetTxId()); | CTransactionRef ptx = mempool.get(outpoint.GetTxId()); | ||||
if (ptx) { | if (ptx) { | ||||
if (outpoint.GetN() < ptx->vout.size()) { | if (outpoint.GetN() < ptx->vout.size()) { | ||||
coin = Coin(ptx->vout[outpoint.GetN()], MEMPOOL_HEIGHT, false); | coin = Coin(ptx->vout[outpoint.GetN()], MEMPOOL_HEIGHT, false); | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
return base->GetCoin(outpoint, coin); | |||||
return base->GetCoin(outpoint, coin) && !coin.IsSpent(); | |||||
} | |||||
bool CCoinsViewMemPool::HaveCoin(const COutPoint &outpoint) const { | |||||
return mempool.exists(outpoint) || base->HaveCoin(outpoint); | |||||
} | } | ||||
size_t CTxMemPool::DynamicMemoryUsage() const { | size_t CTxMemPool::DynamicMemoryUsage() const { | ||||
LOCK(cs); | LOCK(cs); | ||||
// Estimate the overhead of mapTx to be 12 pointers + an allocation, as no | // Estimate the overhead of mapTx to be 12 pointers + an allocation, as no | ||||
// exact formula for boost::multi_index_contained is implemented. | // exact formula for boost::multi_index_contained is implemented. | ||||
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + | return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + | ||||
12 * sizeof(void *)) * | 12 * sizeof(void *)) * | ||||
▲ Show 20 Lines • Show All 362 Lines • Show Last 20 Lines |