Page MenuHomePhabricator

[avalanche] Request for more avalanche nodes when needed
ClosedPublic

Authored by Fabien on Feb 10 2022, 15:14.

Details

Reviewers
tyler-smith
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABCd48106ab0e7c: [avalanche] Request for more avalanche nodes when needed
Summary

This diff spins a new network scheduler task that checks every 5 to 10 minutes whether it is required to request more avalanche nodes, and takes action accordingly.

Since it's running in the scheduler thread, the Peer::m_addr_token_bucket attribute needs to be guarded by a lock. Due to the way it is used, an atomic is not the best option here so a Mutex is used.

Ref T1696.

Depends on D11020, D11033 and D11034.

Test Plan

With Clang and Debug enabled:

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avalanche_request_more_nodes
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18284
Build 36373: Build Diffbuild-clang-tidy · lint-circular-dependencies · build-without-wallet · build-diff · build-clang · build-debug
Build 36372: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Feb 10 2022, 15:14
tyler-smith added a subscriber: tyler-smith.

Looks good. There is one small nit that might be nice to address.

src/net_processing.cpp
1586 ↗(On Diff #32335)

Should we increase this before sending the message? Seems like there's an extremely low chance of there being an issue, but it could be eliminated by increasing the bucket first.

This revision is now accepted and ready to land.Feb 15 2022, 20:41
Fabien planned changes to this revision.Feb 16 2022, 08:27
Fabien added inline comments.
src/net_processing.cpp
1586 ↗(On Diff #32335)

Actually it's an issue, it's even a race. I will fix that.

Fabien edited the summary of this revision. (Show Details)
Fabien edited the test plan for this revision. (Show Details)

Fix a potential race on Peer::m_addr_token_bucket, update summary and test plan accordingly.

This revision is now accepted and ready to land.Feb 16 2022, 10:27

These changes look good with the race fixed.

Fabien retitled this revision from [avalanche] Request for more avalance nodes when needed to [avalanche] Request for more avalanche nodes when needed.Feb 17 2022, 10:39