aboutsummaryrefslogtreecommitdiff
path: root/src/coins.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-07-15 09:13:49 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-15 09:14:33 +0200
commit2c0f019bfc0b9381b6dcad5960df48379b8dfe20 (patch)
treeb9e5b30b1f123f974a004c5c4ad05881ab7195da /src/coins.cpp
parent1f5e8fe804fdf4c717a309c068fc79a97fe72693 (diff)
parentd4d3fbd828a477e8459169a097d5f1bfb69c2781 (diff)
downloadbitcoin-2c0f019bfc0b9381b6dcad5960df48379b8dfe20.tar.xz
Merge pull request #4505
d4d3fbd Do not flush the cache after every block outside of IBD (Pieter Wuille)
Diffstat (limited to 'src/coins.cpp')
-rw-r--r--src/coins.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/coins.cpp b/src/coins.cpp
index e76d8c7ef2..fe40911db7 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -111,7 +111,12 @@ bool CCoinsViewCache::SetCoins(const uint256 &txid, const CCoins &coins) {
}
bool CCoinsViewCache::HaveCoins(const uint256 &txid) {
- return FetchCoins(txid) != cacheCoins.end();
+ CCoinsMap::iterator it = FetchCoins(txid);
+ // We're using vtx.empty() instead of IsPruned here for performance reasons,
+ // as we only care about the case where an transaction was replaced entirely
+ // in a reorganization (which wipes vout entirely, as opposed to spending
+ // which just cleans individual outputs).
+ return (it != cacheCoins.end() && !it->second.vout.empty());
}
uint256 CCoinsViewCache::GetBestBlock() {