HomePhabricator

coins, refactor: Split up AddFlags to remove invalid states

Description

coins, refactor: Split up AddFlags to remove invalid states

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18806

Details

Provenance
Lőrinc <pap.lorinc@gmail.com>Authored on Sep 13 2024, 08:58
PiRKCommitted on Oct 21 2025, 12:42
PiRKPushed on Oct 21 2025, 12:42
Reviewer
Restricted Project
Differential Revision
D18806: coins, refactor: Split up AddFlags to remove invalid states
Parents
rABCc399c76c472f: [dependencies] Patch checksum for nodesetup.sh
Branches
Unknown
Tags
Unknown