aboutsummaryrefslogtreecommitdiff
path: root/src/coins.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-06-08 16:56:50 -0400
committerAlex Morcos <morcos@chaincode.com>2017-06-08 16:56:50 -0400
commit525769853efd7796679bf95d069a432df46d8e35 (patch)
tree9a46b762fe85969d5d0aa8b23e875972dd271d8b /src/coins.cpp
parent9c248e39f2807a7f89e555e99cc55cb2de1ad335 (diff)
downloadbitcoin-525769853efd7796679bf95d069a432df46d8e35.tar.xz
Change semantics of HaveCoinInCache to match HaveCoin
Previously it was possible for HaveCoinInCache to return true for a spent coin. It is more clear to keep the semantics the same. HaveCoinInCache is used for two reasons: - tracking coins we may want to uncache, in which case it is unlikely there would be spent coins we could uncache (not dirty) - optimistically checking whether we have already included a tx in the blockchain, in which case a spent coin is not a reliable indicator that we have.
Diffstat (limited to 'src/coins.cpp')
-rw-r--r--src/coins.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/coins.cpp b/src/coins.cpp
index b45fc76338..b62d0a64d7 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -124,7 +124,7 @@ bool CCoinsViewCache::HaveCoin(const COutPoint &outpoint) const {
bool CCoinsViewCache::HaveCoinInCache(const COutPoint &outpoint) const {
CCoinsMap::const_iterator it = cacheCoins.find(outpoint);
- return it != cacheCoins.end();
+ return (it != cacheCoins.end() && !it->second.coin.IsSpent());
}
uint256 CCoinsViewCache::GetBestBlock() const {