mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 14:45:08 +01:00
refactor: Remove unrealistic simulation state
In non-test code the input coin is never mutated - it's either replaced or ignored.
This commit is contained in:
parent
ab0b5706b2
commit
e31bfb26c2
@ -137,9 +137,8 @@ struct CacheLevel
|
||||
|
||||
/** Class for the base of the hierarchy (roughly simulating a memory-backed CCoinsViewDB).
|
||||
*
|
||||
* The initial state consists of the empty UTXO set, though coins whose output index
|
||||
* is 3 (mod 5) always have GetCoin() succeed (but returning an IsSpent() coin unless a UTXO
|
||||
* exists). Coins whose output index is 4 (mod 5) have GetCoin() always succeed after being spent.
|
||||
* The initial state consists of the empty UTXO set.
|
||||
* Coins whose output index is 4 (mod 5) have GetCoin() always succeed after being spent.
|
||||
* This exercises code paths with spent, non-DIRTY cache entries.
|
||||
*/
|
||||
class CoinsViewBottom final : public CCoinsView
|
||||
@ -151,14 +150,10 @@ public:
|
||||
{
|
||||
auto it = m_data.find(outpoint);
|
||||
if (it == m_data.end()) {
|
||||
if ((outpoint.n % 5) == 3) {
|
||||
coin.Clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
coin = it->second;
|
||||
return true;
|
||||
return true; // TODO GetCoin shouldn't return spent coins
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user