Page MenuHomePhabricator

[avalanche] pass the processor to Chainstate::ActivateBestChain[Step]
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.

This adds g_avalanche access in rpc/blockchain.cpp, but this is only temporary because in a later diff the processor will be avaialble through the node context.

Depends on D16265

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:44
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/test/processor_tests.cpp
2222 ↗(On Diff #48079)

You can actually avoid this and use m_processor directly now

src/rpc/blockchain.cpp
1604 ↗(On Diff #48079)

This will prevent using invalidateblock if avalanche is not enabled (even if that doesn't hold right now that's the expectation behind EnsureAvalanche()), which is not what you want. Same for the other RPCs below

This revision now requires changes to proceed.Tue, Jun 4, 11:44
src/avalanche/test/processor_tests.cpp
2222 ↗(On Diff #48079)

for some reason I'm still getting a segfault if I do the change in this diff, so I did it in the last diff of the stack.

PiRK edited the summary of this revision. (Show Details)

don't use EnsureAvalanche in the RPC code, just assume that the processor can be uninitialized.

This revision is now accepted and ready to land.Tue, Jun 4, 16:26