HomePhabricator

[avalanche] don't use global g_avalanche in BlockAssember

Description

[avalanche] don't use global g_avalanche in BlockAssember

Summary:
This is split out of D16224

Pass the pointer to the constructor, and move the responsibility of invoking the global to callsites (all of which will have access to the avalanche processor via the NodeContext in D16224)

The avalanche argument in the ctor is optional and defaults to nullptr, so we don't have to change all the callsites in tests where g_avalanche is currently not available.

Also add a if (m_avalanche) check before dereferencing the pointer in getblocktemplate while we are touching the file. This is currently redundant because it is already done in IsStakingRewardsActivated() in the same if statement, but in the future it won't be.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16250

Details

Provenance
PiRKAuthored on May 30 2024, 07:17
teamcityPushed on May 30 2024, 13:47
Parents
rSTAGINGf60e3bb66851: [avalanche] introduce EnsureAvalanche helper for RPC calls
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/48053

Event Timeline