From 21180ff73436e198b6828c312ddfd0a1195447b2 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 13 Jun 2017 12:17:30 -0700 Subject: Simplify return values of GetCoin/HaveCoin(InCache) This removes the possibility for GetCoin/HaveCoin/HaveCoinInCache to return true while the respective coin is spent. By doing it across all calls, some extra checks can be eliminated. coins_tests is modified to call HaveCoin sometimes before and sometimes after AccessCoin. A further change is needed because the semantics for GetCoin slightly changed, causing a pruned entry in the parent cache to not be pulled into the child in FetchCoin. --- src/coins.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/coins.h') diff --git a/src/coins.h b/src/coins.h index 4774c9f6a6..077545a55b 100644 --- a/src/coins.h +++ b/src/coins.h @@ -145,11 +145,13 @@ private: class CCoinsView { public: - //! Retrieve the Coin (unspent transaction output) for a given outpoint. + /** Retrieve the Coin (unspent transaction output) for a given outpoint. + * Returns true only when an unspent coin was found, which is returned in coin. + * When false is returned, coin's value is unspecified. + */ virtual bool GetCoin(const COutPoint &outpoint, Coin &coin) const; - //! Just check whether we have data for a given outpoint. - //! This may (but cannot always) return true for spent outputs. + //! Just check whether a given outpoint is unspent. virtual bool HaveCoin(const COutPoint &outpoint) const; //! Retrieve the block hash whose state this CCoinsView currently represents -- cgit v1.2.3