HomePhabricator

addrman: Fix new table bucketing during unserialization

Description

addrman: Fix new table bucketing during unserialization

Summary:

This fixes three issues in addrman unserialization.

  • An addrman entry can appear in up to 8 new table buckets. We store this entry->bucket indexing during shutdown so that on restart we can restore the entries to their correct buckets. Commit ec45646 broke the deserialization code so that each entry could only be put in up to one new bucket.
  • Unserialization may result in an entry appearing in a 9th bucket. If the entry already appears in 8 buckets don't try to place it in another bucket.
  • We unnecessarily rebucket when reading a peers.dat with file version 1. Don't do that.

This is a backport of core#20557

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Dec 3 2020, 10:54
PiRKCommitted on Oct 17 2022, 06:59
PiRKPushed on Oct 17 2022, 06:59
Reviewer
Restricted Project
Differential Revision
D12255: addrman: Fix new table bucketing during unserialization
Parents
rABC9e46755c6926: log: Remove unnecessary timing logs for Callbacks bench
Branches
Unknown
Tags
Unknown