Skip to content

Commit

Permalink
Convert addrdb/addrman to new serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and furszy committed Jul 3, 2021
1 parent 6bb135e commit ace3895
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
10 changes: 1 addition & 9 deletions src/addrdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ class CBanEntry
nCreateTime = nCreateTimeIn;
}

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(nVersion);
READWRITE(nCreateTime);
READWRITE(nBanUntil);
READWRITE(banReason);
}
SERIALIZE_METHODS(CBanEntry, obj) { READWRITE(obj.nVersion, obj.nCreateTime, obj.nBanUntil, obj.banReason); }

void SetNull()
{
Expand Down
12 changes: 4 additions & 8 deletions src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ class CAddrInfo : public CAddress
friend class CAddrMan;

public:
ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action)
SERIALIZE_METHODS(CAddrInfo, obj)
{
READWRITEAS(CAddress, *this);
READWRITE(source);
READWRITE(nLastSuccess);
READWRITE(nAttempts);
READWRITEAS(CAddress, obj);
READWRITE(obj.source, obj.nLastSuccess, obj.nAttempts);
}

void Init()
Expand Down Expand Up @@ -310,7 +306,7 @@ class CAddrMan
* This format is more complex, but significantly smaller (at most 1.5 MiB), and supports
* changes to the ADDRMAN_ parameters without breaking the on-disk structure.
*
* We don't use ADD_SERIALIZE_METHODS since the serialization and deserialization code has
* We don't use SERIALIZE_METHODS since the serialization and deserialization code has
* very little in common.
*/
template <typename Stream>
Expand Down

0 comments on commit ace3895

Please sign in to comment.