Skip to content

Commit

Permalink
net: Use C++11 member initialization in protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed May 19, 2020
1 parent 916e82c commit eac91b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
18 changes: 0 additions & 18 deletions src/protocol.cpp
Expand Up @@ -147,24 +147,6 @@ void SetServiceFlagsIBDCache(bool state) {
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;
}

CInv::CInv()
{
type = 0;
Expand Down
12 changes: 4 additions & 8 deletions src/protocol.h
Expand Up @@ -329,14 +329,11 @@ static inline bool MayHaveUsefulAddressDB(ServiceFlags services)
class CAddress : public CService
{
public:
CAddress();
explicit CAddress(CService ipIn, ServiceFlags nServicesIn);

void Init();
CAddress() : CService{} {};
explicit CAddress(CService ipIn, ServiceFlags nServicesIn) : CService{ipIn}, nServices{nServicesIn} {};

SERIALIZE_METHODS(CAddress, obj)
{
SER_READ(obj, obj.Init());
int nVersion = s.GetVersion();
if (s.GetType() & SER_DISK) {
READWRITE(nVersion);
Expand All @@ -349,10 +346,9 @@ class CAddress : public CService
READWRITEAS(CService, obj);
}

ServiceFlags nServices;

ServiceFlags nServices{NODE_NONE};
// disk and network only
unsigned int nTime;
unsigned int nTime{100000000};
};

/** getdata message type flags */
Expand Down

0 comments on commit eac91b0

Please sign in to comment.