Files
bitcoin/src
Ava Chow 75ec9001ce Merge bitcoin/bitcoin#34207: coins/refactor: enforce GetCoin() returns only unspent coins
2ee7f9b259 coins: assume `GetCoin` only returns unspent coins (Andrew Toth)
eec551aaf1 fuzz: keep `coinscache_sim` backend free of spent coins (Andrew Toth)
3e4155fcef test: do not return spent coins from `CCoinsViewTest::GetCoin` (Andrew Toth)
ee1e40f580 txdb: assert `CCoinsViewDB::GetCoin` only returns unspent coins (Lőrinc)

Pull request description:

  This PR is split out from #33018 to keep that PR focused on removing the `FRESH-but-not-DIRTY` cache state.

  ### Problem
  `::GetCoin()` is an interface for querying the UTXO set, so production implementations should only ever return unspent coins. Tests should mimic this to provide useful feedback.

  ### Fix:
  * Add a fail-fast assertion that `CCoinsViewDB::GetCoin()` never returns a spent coin.
  * Align unit tests and fuzz simulations with the production `GetCoin()` contract by never returning spent coins.
  * Replace the unreachable “spent coin returned by parent” handling in `CCoinsViewCache::FetchCoin()` with `Assert(!coin.IsSpent())`, drop outdated `spent+FRESH` docs, and tighten `SanityCheck()` invariants.

  Behavior is unchanged, it just aligns our tests to exercise valid states.

ACKs for top commit:
  andrewtoth:
    re-ACK 2ee7f9b259
  optout21:
    crACK 2ee7f9b259
  achow101:
    ACK 2ee7f9b259
  w0xlt:
    reACK 2ee7f9b259

Tree-SHA512: be21cc09690410fc04ca25e1ba47aae6186bc037e413b3bb1e6e9a04e6364cbfac5a2fcdc49b638fec848cd29243fab0cc0581b9923f34fafe8366828f690ed4
2026-01-28 14:29:17 -08:00
..
2026-01-20 16:26:50 +00:00
2025-09-03 11:23:30 +01:00
2025-09-30 11:06:43 -07:00
2026-01-22 10:35:14 -05:00
2025-11-14 01:17:38 +02:00
2025-11-14 01:17:38 +02:00