[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