Page MenuHomePhabricator

refactor coins_tests
ClosedPublic

Authored by PiRK on Oct 20 2025, 14:18.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC5341bcc58f8c: refactor coins_tests
Summary

From the PR description:

The last few commits contain significant test refactorings to make coins_tests easier to change in follow-ups.


test, refactor: Migrate GetCoinsMapEntry to return MaybeCoin

https://github.com/bitcoin/bitcoin/pull/30906/commits/ca74aa7490a5005d227da75dc8f2d1ab73c6e9d2


test: Group values and states in tests into CoinEntry wrappers

Note: that this commit affects the test order, but doesn't change its behavior or coverage otherwise.

https://github.com/bitcoin/bitcoin/pull/30906/commits/d5f8d607ab1f8fd9fc17aba4105867b450117be2


test: Validate error messages on fail

The ccoins_add and ccoins_write tests check the actual exception error messages now instead of just that they fail for the given parameters.
This enables us testing different exceptions in a more fine-grained way in later changes.

https://github.com/bitcoin/bitcoin/pull/30906/commits/c0b4b2c1eef95c0b626573a9a2e217f4a541a880


test, refactor: Remove remaining unbounded flags from coins_tests

https://github.com/bitcoin/bitcoin/pull/30906/commits/0a159f0914775756dcac2d9fa7fe4e4d4e70ba0c


test, refactor: Compact ccoins_access and ccoins_spend

Also added an extra check for AccessCoin in CheckAccessCoin to make sure its result is also validated.

https://github.com/bitcoin/bitcoin/pull/30906/commits/50cce20013c97e1257cb9f4c9319701a09b0a196


This concludes backport of core#30906
Depends on D18809

Test Plan

ninja check

Event Timeline

PiRK requested review of this revision.Oct 20 2025, 14:18

back out unrelated change (renaming CheckWriteCoin -> CheckWriteCoins)

@bot guix-linux guix-win guix-osx

This revision is now accepted and ready to land.Oct 21 2025, 11:23
This revision was automatically updated to reflect the committed changes.