test: do not return spent coins from CCoinsViewTest::GetCoin

Production `GetCoin()` implementations only return unspent coins.

Update the `CCoinsView` test backend to match that contract, so tests stop exercising cache states that cannot occur with `CCoinsViewCache` or `CCoinsViewDB`.

Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
Andrew TothandLőrinc authored and Lőrinc committed 2026-01-06 12:16:46 +01:00
1 parent ee1e40f580
commit 3e4155fcef
1 file changed
+1 -5
+1 -5
View File
@@ -48,11 +48,7 @@ public:
std::optional<Coin> GetCoin(const COutPoint& outpoint) const override
{
if (auto it{map_.find(outpoint)}; it != map_.end()) {
if (!it->second.IsSpent() || m_rng.randbool()) {
return it->second; // TODO spent coins shouldn't be returned
}
}
if (auto it{map_.find(outpoint)}; it != map_.end() && !it->second.IsSpent()) return it->second;
return std::nullopt;
}