aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2014-07-24 16:46:30 +0200
committerWladimir J. van der Laan <[email protected]>2014-07-24 16:46:38 +0200
commit7eb3d6152febe9e19378d5e3ba4ec88450724436 (patch)
tree8e284c84c8c45360e938ac5bde980b7a4f9062ef /src/txmempool.cpp
parentFix typos in comments (missing i's). (diff)
parentBugfix: make CCoinsViewMemPool support pruned entries in underlying cache (diff)
downloaddiscoin-7eb3d6152febe9e19378d5e3ba4ec88450724436.tar.xz
discoin-7eb3d6152febe9e19378d5e3ba4ec88450724436.zip
Merge pull request #4575
ad08d0b Bugfix: make CCoinsViewMemPool support pruned entries in underlying cache (Pieter Wuille)
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index ebb1369e3..164e2741a 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -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) {