aboutsummaryrefslogtreecommitdiff
path: root/src/coins.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-07-10 17:35:22 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-07-11 16:44:53 +0200
commitd4d3fbd828a477e8459169a097d5f1bfb69c2781 (patch)
treeaf5ca954ae1c347891905b459e9d30e858997f2c /src/coins.cpp
parentd3165ed35adde59bdfbe72928b51a039202fa21e (diff)
Do not flush the cache after every block outside of IBD
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 13a4ea95cd..3ab03e047f 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -107,7 +107,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() {