mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #18698: Make g_chainman internal to validation
fab6b9d18fvalidation: Mark g_chainman DEPRECATED (MarcoFalke)fa1d97b256validation: Make ProcessNewBlock*() members of ChainstateManager (MarcoFalke)fa24d49098validation: Make PruneOneBlockFile() a member of ChainstateManager (MarcoFalke)fa84b1cd84validation: Make LoadBlockIndex() a member of ChainstateManager (MarcoFalke)fa05fdf0f1net: Pass chainman into PeerLogicValidation (MarcoFalke)fa7b626d7anode: Add chainman alias for g_chainman (MarcoFalke) Pull request description: The global `g_chainman` has recently been introduced in #17737. The chainstate manager is primarily needed for the assumeutxo feature, but it can also simplify testing in the future. The goal of this pull is to make the global chainstate manager internal to validation, so that all external code does not depend on globals and that unit or fuzz tests can pass in their (potentially mocked) chainstate manager. I suggest reviewing the pull request commit-by-commit. It should be relatively straightforward refactoring that does not change behavior at all. ACKs for top commit: ryanofsky: Code review ACKfab6b9d18f. Had to be rebased but still looks good Tree-SHA512: dcbf114aeef4f8320d466369769f22ce4dd8f46a846870354df176c3de9ff17c64630fbd777e7121d7470d7a8564ed8d37b77168746e8df7489c6877e55d7b4f
This commit is contained in:
@@ -71,6 +71,12 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
|
||||
return *node.mempool;
|
||||
}
|
||||
|
||||
ChainstateManager& EnsureChainman(const util::Ref& context)
|
||||
{
|
||||
NodeContext& node = EnsureNodeContext(context);
|
||||
return EnsureChainman(node);
|
||||
}
|
||||
|
||||
/* Calculate the difficulty for a given block index.
|
||||
*/
|
||||
double GetDifficulty(const CBlockIndex* blockindex)
|
||||
|
||||
Reference in New Issue
Block a user