Page MenuHomePhabricator

addrman: Fix new table bucketing during unserialization
ClosedPublic

Authored by PiRK on Oct 14 2022, 13:25.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC509469aab7ea: 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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable