HomePhabricator

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

Description

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

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

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Subscribers: sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D13029

Details

Provenance
FabienAuthored on Jan 23 2023, 11:02
FabienPushed on Jan 24 2023, 17:10
Reviewer
Restricted Project
Differential Revision
D13029: [avalanche] Allow for overwriting a null delegation with another avahello
Parents
rABC6c5f09efeba5: [avalanche] Fix a wrong test in abc_rpc_avalancheproof
Branches
Unknown
Tags
Unknown