diff options
author | James O'Beirne <james.obeirne@pm.me> | 2022-11-10 12:03:39 -0500 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2023-09-30 06:38:47 -0400 |
commit | c6af23c5179cc383f8e6c275373af8d11e6a989f (patch) | |
tree | fc1e40adedb0c37ad064799580e536515cc47628 /src/validation.cpp | |
parent | 9f2318c76cc6986d48e13831cf5bd8dab194fdf4 (diff) | |
download | bitcoin-c6af23c5179cc383f8e6c275373af8d11e6a989f.tar.xz |
validation: add ChainstateRole
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index e2091a2c9a..9a543d3a38 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5813,6 +5813,16 @@ bool ChainstateManager::DeleteSnapshotChainstate() return true; } +ChainstateRole Chainstate::GetRole() const +{ + if (m_chainman.GetAll().size() <= 1) { + return ChainstateRole::NORMAL; + } + return (this != &m_chainman.ActiveChainstate()) ? + ChainstateRole::BACKGROUND : + ChainstateRole::ASSUMEDVALID; +} + const CBlockIndex* ChainstateManager::GetSnapshotBaseBlock() const { return m_active_chainstate ? m_active_chainstate->SnapshotBase() : nullptr; |