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