Page MenuHomePhabricator

[avalanche] Allow for overwriting a null delegation with another avahello
ClosedPublic

Authored by Fabien on Jan 23 2023, 20:36.

Details

Summary

It is possible for a node to send a null delegation as part of the avahello message, telling the peer it supports avalanche but has no proof. This diff lets that node send another avahello with a non-null delegation to signal that it has a proof. This enables delaying sending our proof to our peers until certain conditions are met, like checking we are accepting inbound connections.

Note that setting the m_avalanche_enabled flag after the peer is added doesn't change the behavior but makes more sense. Also to keep the operation thread safe now that the flag isn't used as a state lock anymore, a new mutex has tp be added to guard the logic surrounding the pubkey.

Test Plan

With Debug and Clang:

ninja all check-all

Run the TSAN build

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Jan 23 2023, 20:36
sdulfari requested changes to this revision.Jan 23 2023, 22:16
sdulfari added a subscriber: sdulfari.
sdulfari added inline comments.
src/net_processing.cpp
4987 ↗(On Diff #37645)

Isn't this to prevent a race with RPC calls to addavalanchenode while the node finds the same peer on the network?

This revision now requires changes to proceed.Jan 23 2023, 22:16
Fabien edited the test plan for this revision. (Show Details)
Fabien edited the test plan for this revision. (Show Details)

Add a lock to prevent a race with addavalanchenode

This revision is now accepted and ready to land.Jan 24 2023, 16:25