Page MenuHomePhabricator

[avalanche] pass the avalanche processor to Chainstate::LoadExternalBlockFile and ThreadImport
ClosedPublic

Authored by PiRK on Jun 4 2024, 10:11.

Details

Summary

Another step in removing access to the g_avalanche global in Chainstate code.

Depends on D16266

Test Plan

ninja all check-all

Event Timeline

Fabien requested changes to this revision.Jun 4 2024, 11:49
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/node/blockstorage.h
300 ↗(On Diff #48080)

What if avalanche is not enabled ?

This revision now requires changes to proceed.Jun 4 2024, 11:49
PiRK requested review of this revision.Jun 4 2024, 14:12
PiRK added inline comments.
src/node/blockstorage.h
300 ↗(On Diff #48080)

At the moment there is no code path that can call this function with the avalanche processor not being initialized. So I thought it is good to demonstrate it by passing a reference, so that code readers don't need to wonder about it.

we can pass a pointer to ThreadImport in anticipation of not initializing the avalanche processor when avalanche is not needed (see review D16224)

PiRK planned changes to this revision.Jun 4 2024, 14:59

pass a pointer to the processor in ThreadImport

src/init.cpp
2667

Is the shutdown code checking that m_load_block is joined before deleting the avalanche pointer ? Just making sure we don't introduce shutdown crashes

src/init.cpp
2667

Yes. In Shutdown we call node.chainman->m_load_block.join() before reseting the avalanche pointer.?

This revision is now accepted and ready to land.Jun 5 2024, 07:33