mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04: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
1 changed files with 3 additions and 8 deletions
|
@ -137,9 +137,8 @@ struct CacheLevel
|
||||||
|
|
||||||
/** Class for the base of the hierarchy (roughly simulating a memory-backed CCoinsViewDB).
|
/** 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
|
* The initial state consists of the empty UTXO set.
|
||||||
* is 3 (mod 5) always have GetCoin() succeed (but returning an IsSpent() coin unless a UTXO
|
* Coins whose output index is 4 (mod 5) have GetCoin() always succeed after being spent.
|
||||||
* exists). 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.
|
* This exercises code paths with spent, non-DIRTY cache entries.
|
||||||
*/
|
*/
|
||||||
class CoinsViewBottom final : public CCoinsView
|
class CoinsViewBottom final : public CCoinsView
|
||||||
|
@ -151,14 +150,10 @@ public:
|
||||||
{
|
{
|
||||||
auto it = m_data.find(outpoint);
|
auto it = m_data.find(outpoint);
|
||||||
if (it == m_data.end()) {
|
if (it == m_data.end()) {
|
||||||
if ((outpoint.n % 5) == 3) {
|
|
||||||
coin.Clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
coin = it->second;
|
coin = it->second;
|
||||||
return true;
|
return true; // TODO GetCoin shouldn't return spent coins
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue