Page MenuHomePhabricator

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

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

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCc8fabc010fdc: [avalanche] don't use global g_avalanche in net_processing
Summary

This diff is split out of D16224.

Pass the avalanche processor as a const pointer in the PeerManagerImpl constructor.
In most unit tests we currently pass it nullptr, except in processor_tests. This preserves the current behavior.

Depends on D16255

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.May 30 2024, 12:37

remove the now redundant assertion

Fabien requested changes to this revision.May 30 2024, 13:18
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/net_processing.cpp
8325 ↗(On Diff #48045)

duplicated

8342 ↗(On Diff #48045)

style nit: [this, isStaker]

src/net_processing.h
58 ↗(On Diff #48045)

Can't be const avalanche::Processor *const avalanche ?

This revision now requires changes to proceed.May 30 2024, 13:18
src/net_processing.h
58 ↗(On Diff #48045)

I don't think so. The peer manager calls non-const processor functions (such as registerVotes, for example)

I confirm that I cannot make the processor const here. It fails to compile.

src/net_processing.cpp
8325 ↗(On Diff #48045)

assertion removed in parent diff. The callsites all check for m_avalanche before calling this function

This revision is now accepted and ready to land.May 30 2024, 20:34