Skip to content

Commit e31bfb2

Browse files
committed
refactor: Remove unrealistic simulation state
In non-test code the input coin is never mutated - it's either replaced or ignored.
1 parent ab0b570 commit e31bfb2

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/test/fuzz/coinscache_sim.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ struct CacheLevel
137137

138138
/** Class for the base of the hierarchy (roughly simulating a memory-backed CCoinsViewDB).
139139
*
140-
* The initial state consists of the empty UTXO set, though coins whose output index
141-
* is 3 (mod 5) always have GetCoin() succeed (but returning an IsSpent() coin unless a UTXO
142-
* exists). Coins whose output index is 4 (mod 5) have GetCoin() always succeed after being spent.
140+
* The initial state consists of the empty UTXO set.
141+
* Coins whose output index is 4 (mod 5) have GetCoin() always succeed after being spent.
143142
* This exercises code paths with spent, non-DIRTY cache entries.
144143
*/
145144
class CoinsViewBottom final : public CCoinsView
@@ -151,14 +150,10 @@ class CoinsViewBottom final : public CCoinsView
151150
{
152151
auto it = m_data.find(outpoint);
153152
if (it == m_data.end()) {
154-
if ((outpoint.n % 5) == 3) {
155-
coin.Clear();
156-
return true;
157-
}
158153
return false;
159154
} else {
160155
coin = it->second;
161-
return true;
156+
return true; // TODO GetCoin shouldn't return spent coins
162157
}
163158
}
164159

0 commit comments

Comments
 (0)