Page MenuHomePhabricator

p2p: Avoid InitError when downgrading peers.dat
ClosedPublic

Authored by Fabien on Oct 21 2022, 09:14.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC9c011e33ade6: 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

Diff Detail

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