validation: add chainman ref to CChainState

Add an upwards reference to chainstate instances to the owning
ChainstateManager. This is necessary because there are a number
of `this_chainstate == chainman.ActiveChainstate()` checks that
will happen (as a result of assumeutxo) in functions that otherwise
don't have an easily-accessible reference to the chainstate's
ChainManager.
This commit is contained in:
James O'Beirne
2021-06-12 10:52:40 -04:00
parent d86e6625e8
commit 9f6bb53935
3 changed files with 18 additions and 6 deletions

View File

@@ -601,9 +601,15 @@ public:
//! CChainState instances.
BlockManager& m_blockman;
//! The chainstate manager that owns this chainstate. The reference is
//! necessary so that this instance can check whether it is the active
//! chainstate within deeply nested method calls.
ChainstateManager& m_chainman;
explicit CChainState(
CTxMemPool* mempool,
BlockManager& blockman,
ChainstateManager& chainman,
std::optional<uint256> from_snapshot_blockhash = std::nullopt);
/**