Page MenuHomePhabricator

net: CAddress & CAddrMan: (un)serialize as ADDRv2
ClosedPublic

Authored by Fabien on Feb 10 2021, 11:07.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABCe9b2955f860d: net: CAddress & CAddrMan: (un)serialize as ADDRv2
Summary
Change the serialization of `CAddrMan` to serialize its addresses
in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format
version (3).

Add support for ADDRv2 format in `CAddress` (un)serialization.

Partial backport (2/4) of core PR19954:
https://github.com/bitcoin/bitcoin/pull/19954/commits/201a4596d92d640d5eb7e76cc8d959228fa09dbb

Includes a fix for the symbol check that would cause the gitian build to
fail:
Backport of core PR20129.
and a fix for a mismatch initialization order in the CAddress class
(reversal of nTime and nServices to match core).

Depends on D9190 and D9198.

Test Plan
ninja all check-all

Run the Linux Gitian build.

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Feb 10 2021, 11:07
This revision is now accepted and ready to land.Feb 10 2021, 17:48

Note: this is also a backport of core#19705:

Shrink CAddress from 48 to 40 bytes on x64

CAddress inherits CService which is 28 bytes (on 64 bit machines).
CAddress then adds two member variables - one that requires 4 byte
alignment (nTime) and one that requires 8 byte alignment
(nServices).

Declare the smaller one first so that it fits in bytes 29..32.

On 32 bit machines this change has no effect and CAddress remains 40
bytes.