mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Bugfix: make CCoinsViewMemPool support pruned entries in underlying cache
This commit is contained in:
parent
cdb4193a31
commit
ad08d0b95b
@ -602,14 +602,15 @@ void CTxMemPool::ClearPrioritisation(const uint256 hash)
|
||||
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
|
||||
|
||||
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) {
|
||||
if (base->GetCoins(txid, coins))
|
||||
return true;
|
||||
// If an entry in the mempool exists, always return that one, as it's guaranteed to never
|
||||
// conflict with the underlying cache, and it cannot have pruned entries (as it contains full)
|
||||
// transactions. First checking the underlying cache risks returning a pruned entry instead.
|
||||
CTransaction tx;
|
||||
if (mempool.lookup(txid, tx)) {
|
||||
coins = CCoins(tx, MEMPOOL_HEIGHT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (base->GetCoins(txid, coins) && !coins.IsPruned());
|
||||
}
|
||||
|
||||
bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) {
|
||||
|
Loading…
Reference in New Issue
Block a user