Page MenuHomePhabricator

[avalanche] don't use global g_avalanche in BlockAssember
ClosedPublic

Authored by PiRK on May 30 2024, 07:37.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC7b05328dd000: [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