HomePhabricator

[avalanche] Actually dump/load the peers list upon shutdown/startup

Description

[avalanche] Actually dump/load the peers list upon shutdown/startup

Summary:
This has several benefits:

  • It makes the avalanche bootstraping faster
  • It solves the issue of the local proof requiring a block to be verified (if the proof was in the dump)
  • It makes the selection of the staking reward winner faster

The tests that are not designed to work with loading the file (i.e. tests that restart the nodes) have the feature disabled.

There are a few implementation details that need to be explained:

  • The change to the getavalancheinfo RPC is needed to make the local proof recognized when loaded from the dump file. Previously it was only registered from the processor using the local data so comparing using the identify function was enough, but it's on longer the case as the local proof is now deserialized from the file.
  • The staking rewards are computed upon block connection, so in order to not have to wait for a block to get the next winner when the proofs are loaded from the dump file, the computation is also processed once when ready_to_poll turns true.
  • I added some logs to make it easier to check the file is dumped/loaded as expected. It happens once opon startup and once upon shutdown and only if the avalanche debug category is enabled so it won't bloat the logs.

Depends on D14834.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

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

Details

Provenance
FabienAuthored on Nov 21 2023, 20:12
FabienPushed on Nov 22 2023, 14:20
Reviewer
Restricted Project
Differential Revision
D14833: [avalanche] Actually dump/load the peers list upon shutdown/startup
Parents
rABC2db7298bc3cd: Use std::chrono for the time to rotate destination of addr messages + tests
Branches
Unknown
Tags
Unknown