mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Restore compatibility with old CSubNet serialization
This commit is contained in:
parent
0b2abaa666
commit
883cea7dea
1 changed files with 15 additions and 1 deletions
|
@ -468,7 +468,21 @@ class CSubNet
|
|||
friend bool operator!=(const CSubNet& a, const CSubNet& b) { return !(a == b); }
|
||||
friend bool operator<(const CSubNet& a, const CSubNet& b);
|
||||
|
||||
SERIALIZE_METHODS(CSubNet, obj) { READWRITE(obj.network, obj.netmask, obj.valid); }
|
||||
SERIALIZE_METHODS(CSubNet, obj)
|
||||
{
|
||||
READWRITE(obj.network);
|
||||
if (obj.network.IsIPv4()) {
|
||||
// Before commit 102867c587f5f7954232fb8ed8e85cda78bb4d32, CSubNet used the last 4 bytes of netmask
|
||||
// to store the relevant bytes for an IPv4 mask. For compatiblity reasons, keep doing so in
|
||||
// serialized form.
|
||||
unsigned char dummy[12] = {0};
|
||||
READWRITE(dummy);
|
||||
READWRITE(MakeSpan(obj.netmask).first(4));
|
||||
} else {
|
||||
READWRITE(obj.netmask);
|
||||
}
|
||||
READWRITE(obj.valid);
|
||||
}
|
||||
};
|
||||
|
||||
/** A combination of a network address (CNetAddr) and a (TCP) port */
|
||||
|
|
Loading…
Add table
Reference in a new issue