mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
Merge pull request #4575
ad08d0b Bugfix: make CCoinsViewMemPool support pruned entries in underlying cache (Pieter Wuille)
This commit is contained in:
commit
7eb3d6152f
@ -602,14 +602,15 @@ void CTxMemPool::ClearPrioritisation(const uint256 hash)
|
|||||||
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
|
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
|
||||||
|
|
||||||
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) {
|
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) {
|
||||||
if (base->GetCoins(txid, coins))
|
// If an entry in the mempool exists, always return that one, as it's guaranteed to never
|
||||||
return true;
|
// 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;
|
CTransaction tx;
|
||||||
if (mempool.lookup(txid, tx)) {
|
if (mempool.lookup(txid, tx)) {
|
||||||
coins = CCoins(tx, MEMPOOL_HEIGHT);
|
coins = CCoins(tx, MEMPOOL_HEIGHT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return (base->GetCoins(txid, coins) && !coins.IsPruned());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) {
|
bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user