HomePhabricator

p2p: Avoid InitError when downgrading peers.dat

Description

p2p: Avoid InitError when downgrading peers.dat

Summary:

When downgrading, a peers.dat with a future version that has a minimum required version larger than the downgraded version would cause an InitError.

This commit changes this behavior to overwrite the existing peers.dat with a new empty one, while creating a backup in peers.dat.bak.

Backport of core#24201.

This can't be used with the recent v4 format update but will make for a better UX if the peers.dat format is changed in the future.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
junderw <junderwood@bitcoinbank.co.jp>Authored on Jan 29 2022, 12:58
FabienCommitted on Oct 21 2022, 15:42
FabienPushed on Oct 21 2022, 15:43
Reviewer
Restricted Project
Differential Revision
D12348: p2p: Avoid InitError when downgrading peers.dat
Parents
rABC72d04136328d: [doc] Add a release note about the removal of the default port preference for…
Branches
Unknown
Tags
Unknown