Convert addrdb/addrman to new serialization

This commit is contained in:
Pieter Wuille 2017-07-07 16:08:51 -07:00
parent ca33451535
commit 9250a087d2
2 changed files with 6 additions and 18 deletions

View file

@ -49,15 +49,7 @@ public:
banReason = ban_reason_in; banReason = ban_reason_in;
} }
ADD_SERIALIZE_METHODS; SERIALIZE_METHODS(CBanEntry, obj) { READWRITE(obj.nVersion, obj.nCreateTime, obj.nBanUntil, obj.banReason); }
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(this->nVersion);
READWRITE(nCreateTime);
READWRITE(nBanUntil);
READWRITE(banReason);
}
void SetNull() void SetNull()
{ {

View file

@ -53,14 +53,10 @@ private:
public: public:
ADD_SERIALIZE_METHODS; SERIALIZE_METHODS(CAddrInfo, obj)
{
template <typename Stream, typename Operation> READWRITEAS(CAddress, obj);
inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(obj.source, obj.nLastSuccess, obj.nAttempts);
READWRITEAS(CAddress, *this);
READWRITE(source);
READWRITE(nLastSuccess);
READWRITE(nAttempts);
} }
CAddrInfo(const CAddress &addrIn, const CNetAddr &addrSource) : CAddress(addrIn), source(addrSource) CAddrInfo(const CAddress &addrIn, const CNetAddr &addrSource) : CAddress(addrIn), source(addrSource)
@ -294,7 +290,7 @@ public:
* This format is more complex, but significantly smaller (at most 1.5 MiB), and supports * 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. * 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. * very little in common.
*/ */
template<typename Stream> template<typename Stream>