Skip to content

Commit faba65e

Browse files
author
MarcoFalke
committed
Add ChainstateManager::ActiveChainstate
1 parent fabf3d6 commit faba65e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5251,10 +5251,10 @@ CChainState& ChainstateManager::InitializeChainstate(const uint256& snapshot_blo
52515251
return *to_modify;
52525252
}
52535253

5254-
CChain& ChainstateManager::ActiveChain() const
5254+
CChainState& ChainstateManager::ActiveChainstate() const
52555255
{
52565256
assert(m_active_chainstate);
5257-
return m_active_chainstate->m_chain;
5257+
return *m_active_chainstate;
52585258
}
52595259

52605260
bool ChainstateManager::IsSnapshotActive() const

src/validation.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,8 @@ class ChainstateManager
799799
std::vector<CChainState*> GetAll();
800800

801801
//! The most-work chain.
802-
CChain& ActiveChain() const;
802+
CChainState& ActiveChainstate() const;
803+
CChain& ActiveChain() const { return ActiveChainstate().m_chain; }
803804
int ActiveHeight() const { return ActiveChain().Height(); }
804805
CBlockIndex* ActiveTip() const { return ActiveChain().Tip(); }
805806

@@ -879,13 +880,13 @@ class ChainstateManager
879880
/** DEPRECATED! Please use node.chainman instead. May only be used in validation.cpp internally */
880881
extern ChainstateManager g_chainman GUARDED_BY(::cs_main);
881882

882-
/** @returns the most-work valid chainstate. */
883+
/** Please prefer the identical ChainstateManager::ActiveChainstate */
883884
CChainState& ChainstateActive();
884885

885-
/** @returns the most-work chain. */
886+
/** Please prefer the identical ChainstateManager::ActiveChain */
886887
CChain& ChainActive();
887888

888-
/** @returns the global block index map. */
889+
/** Please prefer the identical ChainstateManager::BlockIndex */
889890
BlockMap& BlockIndex();
890891

891892
/** Global variable that points to the active block tree (protected by cs_main) */

0 commit comments

Comments
 (0)