diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h --- a/src/compat/assumptions.h +++ b/src/compat/assumptions.h @@ -52,6 +52,7 @@ // code. static_assert(sizeof(short) == 2, "16-bit short assumed"); static_assert(sizeof(int) == 4, "32-bit int assumed"); +static_assert(sizeof(unsigned) == 4, "32-bit unsigned assumed"); // Assumption: We assume 8-bit bytes, because 32-bit int and 16-bit short are // assumed. diff --git a/src/protocol.h b/src/protocol.h --- a/src/protocol.h +++ b/src/protocol.h @@ -420,14 +420,17 @@ * A CService with information about it as peer. */ class CAddress : public CService { + static constexpr uint32_t TIME_INIT{100000000}; + public: - CAddress(); - explicit CAddress(CService ipIn, ServiceFlags nServicesIn); + CAddress() : CService{} {}; + explicit CAddress(CService ipIn, ServiceFlags nServicesIn) + : CService{ipIn}, nServices{nServicesIn} {}; void Init(); SERIALIZE_METHODS(CAddress, obj) { - SER_READ(obj, obj.Init()); + SER_READ(obj, obj.nTime = TIME_INIT); int nVersion = s.GetVersion(); if (s.GetType() & SER_DISK) { READWRITE(nVersion); @@ -446,10 +449,10 @@ READWRITEAS(CService, obj); } - ServiceFlags nServices; + ServiceFlags nServices{NODE_NONE}; // disk and network only - unsigned int nTime; + uint32_t nTime{TIME_INIT}; }; /** getdata message type flags */ diff --git a/src/protocol.cpp b/src/protocol.cpp --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -213,20 +213,6 @@ g_initial_block_download_completed = state; } -CAddress::CAddress() : CService() { - Init(); -} - -CAddress::CAddress(CService ipIn, ServiceFlags nServicesIn) : CService(ipIn) { - Init(); - nServices = nServicesIn; -} - -void CAddress::Init() { - nServices = NODE_NONE; - nTime = 100000000; -} - std::string CInv::GetCommand() const { std::string cmd; switch (GetKind()) {