Page MenuHomePhabricator

validation: add CChainState::m_disabled and ChainMan::isUsable
ClosedPublic

Authored by PiRK on Oct 25 2023, 06:17.

Details

Summary

and remove m_snapshot_validated. This state can now be inferred by the
number of isUsable chainstates.

m_disabled is used to signal that a chainstate should no longer be used
by validation logic; it is used as a sentinel when background validation
completes or if the snapshot chainstate is found to be invalid.

isUsable is a convenience method that incorporates m_disabled.

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

Depends on D14673

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Oct 25 2023, 06:17
Fabien requested changes to this revision.Oct 25 2023, 09:38
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/validation.cpp
5773

dito

src/validation.h
1146

Can we rename the param to pchainstate or something similar ? cs usually stands for critical section, hence cs_main so this is confusing as it sounds like a mutex

This revision now requires changes to proceed.Oct 25 2023, 09:38

rename cs -> pchainstate

This revision is now accepted and ready to land.Oct 26 2023, 09:04