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 Thu, May 30, 07:17
PiRKPushed on Thu, May 30, 13:42
Reviewer
Restricted Project
Differential Revision
D16250: [avalanche] don't use global g_avalanche in BlockAssember
Parents
rABCf60e3bb66851: [avalanche] introduce EnsureAvalanche helper for RPC calls
Branches
Unknown
Tags
Unknown