Page MenuHomePhabricator

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

Authored by PiRK on Tue, Jun 4, 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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Tue, Jun 4, 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.Tue, Jun 4, 11:49
PiRK requested review of this revision.Tue, Jun 4, 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.Tue, Jun 4, 14:59

pass a pointer to the processor in ThreadImport

src/init.cpp
2667 ↗(On Diff #48091)

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 ↗(On Diff #48091)

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.Wed, Jun 5, 07:33