Page MenuHomePhabricator

coins, refactor: Split up AddFlags to remove invalid states
ClosedPublic

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

Details

Summary

CCoinsCacheEntry provided general access to its internal flags state, even though in reality it could only be clean, fresh, dirty or fresh|dirty.

After it got dirtied we couldn't set the state back to clean by AddFlags(0) - tests were explicitly checking against that.

This commit cleans up the public interface to make this distinction cleaner and invalid behavior impossible instead of just checked by tests.
This includes the removal of redundant inline qualifiers (we're inside a struct).
Also renamed self to pair to simplify the upcoming commits.

Also modernized EmplaceCoinInternalDANGER since it was already modified.

Co-authored-by: Andrew Toth <andrewstoth@gmail.com>

This is a partial backport of core#30906
https://github.com/bitcoin/bitcoin/pull/30906/commits/cd0498eabc910efa3ed7a6d32e687107248bb5be

Test Plan

ninja all check-all bitcoin-fuzzers

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable