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-24 00:44:22 +01:00
2026-01-27 13:26:43 +01:00
2026-01-22 12:39:52 +01:00
2026-01-20 15:47:17 -08:00
2025-08-07 09:27:25 +01:00
2026-01-14 23:04:12 +01:00
2026-01-20 16:26:50 +00:00
2026-01-27 13:08:50 +01:00
2026-01-28 13:43:56 +01:00
2026-01-21 15:07:23 +00:00
2026-01-23 15:10:54 +00:00
2025-10-16 13:49:49 +01:00
2025-12-16 22:21:15 +01:00
2025-10-13 12:33:23 +01:00
2026-01-28 13:43:56 +01:00
2026-01-14 23:04:12 +01:00
2026-01-28 17:08:34 +01:00
2026-01-28 13:43:56 +01:00
2026-01-27 13:26:43 +01:00
2026-01-20 12:17:19 -08:00
2026-01-27 09:56:12 +00:00
2026-01-20 15:35:19 +01:00
2026-01-28 14:29:17 -08:00
2025-12-16 22:21:15 +01:00
2026-01-27 13:26:43 +01:00
2026-01-28 11:25:28 -08:00
2025-12-16 22:21:15 +01:00
2026-01-19 17:11:23 +00:00
2026-01-21 13:23:43 +01:00
2025-07-10 11:24:40 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-12-19 16:56:02 +00:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-09-12 22:28:41 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-21 19:40:25 +05:30
2026-01-12 15:02:14 -05:00
2025-12-19 16:56:02 +00:00
2025-12-16 22:21:15 +01:00
2025-10-06 19:41:35 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-19 20:20:13 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 11:38:07 -08:00
2026-01-14 11:38:07 -08:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2026-01-14 23:04:12 +01:00
2025-09-03 11:23:30 +01:00
2025-12-16 22:21:15 +01:00
2025-11-13 09:33:36 +01:00
2025-12-16 22:21:15 +01:00
2026-01-12 17:38:30 -05:00
2026-01-19 12:57:16 +01:00
2026-01-11 21:32:52 +01:00
2026-01-11 21:32:52 +01:00
2025-12-16 22:21:15 +01:00
2026-01-20 15:41:30 -08:00
2026-01-19 12:57:16 +01:00
2025-12-16 22:21:15 +01:00
2025-12-12 06:49:59 -04:00
2025-12-12 06:49:59 -04:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:03:47 +01:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-11-20 11:34:21 +09:00
2025-11-20 11:34:21 +09:00
2025-12-19 16:56:02 +00:00
2025-12-16 22:21:15 +01:00
2026-01-28 13:43:56 +01:00
2025-12-16 22:21:15 +01:00
2025-12-13 13:43:24 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-28 13:43:56 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-10-14 16:25:52 -04:00
2025-09-30 11:06:43 -07:00
2026-01-12 15:02:14 -05:00
2026-01-12 15:02:14 -05:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 11:38:07 -08:00
2025-12-16 22:21:15 +01:00
2025-11-24 18:48:43 +01:00
2025-11-24 18:48:43 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-27 12:59:33 +01:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-28 13:43:56 +01:00
2026-01-20 16:45:18 +01:00
2025-10-02 12:53:55 +01:00
2026-01-14 23:04:12 +01:00
2026-01-22 10:35:14 -05:00
2026-01-23 13:25:42 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 19:39:01 +01:00
2026-01-14 19:36:14 +01:00
2025-10-02 12:53:55 +01:00
2025-10-02 12:53:55 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:04:12 +01:00
2025-11-03 14:39:50 +01:00
2025-12-16 17:53:50 +01:00
2025-12-16 17:53:50 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-01-14 23:03:47 +01:00
2026-01-14 23:03:47 +01:00
2025-09-30 11:06:09 -07:00
2025-11-03 14:39:48 +01:00
2025-07-25 09:50:50 +02:00
2026-01-14 23:04:12 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-14 10:04:37 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-10-30 17:51:53 +01:00
2026-01-20 15:47:17 -08:00
2025-12-21 10:24:09 +01:00
2025-11-14 01:17:38 +02:00
2025-11-14 01:17:38 +02:00
2025-12-19 16:56:02 +00:00
2026-01-21 14:51:12 +01:00
2025-12-16 22:21:15 +01:00
2026-01-20 15:30:46 +01:00
2025-12-16 22:21:15 +01:00
2026-01-06 12:16:45 +01:00
2026-01-02 16:49:23 -08:00
2026-01-12 17:38:30 -05:00
2025-11-25 07:36:50 -05:00
2026-01-22 21:51:13 -05:00
2026-01-22 21:51:13 -05:00
2025-12-18 22:38:02 +01:00
2025-12-30 12:12:26 -08:00
2025-12-16 22:21:15 +01:00
2025-11-03 14:39:48 +01:00
2025-12-16 22:21:15 +01:00
2026-01-24 00:44:22 +01:00
2026-01-14 11:38:07 -08:00
2025-12-16 22:21:15 +01:00
2025-12-12 06:49:59 -04:00
2025-12-16 22:21:15 +01:00
2025-12-19 16:56:02 +00:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00