HomePhabricator

[avalanche] Move contender cache to peer manager

Description

[avalanche] Move contender cache to peer manager

Summary:
addStakeContender() being called from net_processing is not robust because there are various ways a proof may be introduced (via network, RPC, loaded at startup, etc). This results in the cache being unaware of proofs in various scenarios, eventually breaking contender voting. The robust solution is to put peerManager in charge of adding contenders to the cache whenever a proof is successfully registered. This is the first step to achieving that.

This diff only moves the cache with minimal other changes (excepting some locking fixes). The pass-through API of the cache in peermanager is not ideal, however some of these can be refactored away in future diffs to reduce future maintenance overhead.

There is no change in behavior.

Test Plan:

ninja check check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
roqqitAuthored on Wed, Mar 12, 17:09
roqqitPushed on Fri, Mar 14, 20:40
Reviewer
Restricted Project
Differential Revision
D17788: [avalanche] Move contender cache to peer manager
Parents
rABC459f2bd542e5: [token-server] Soften recaptcha check
Branches
Unknown
Tags
Unknown