mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge #15144: [refactor] CNode: Use C++11 default member initializers
fac2f5ecae Use C++11 default member initializers (MarcoFalke)
Pull request description:
The second and last change on this topic (c.f. #15109). Split up because the diff would otherwise interleave, making review harder than necessary.
This is not a stylistic change, but a change that avoids bugs such as:
* fix uninitialized read when stringifying an addrLocal #14728
* qt: Initialize members in WalletModel #12426
* net: correctly initialize nMinPingUsecTime #6636
* ...
Tree-SHA512: 547ae72b87aeaed5890eb5fdcff612bfc93354632b238d89e1e1c0487187f39609bcdc537ef21345e0aea8cfcf1ea48da432d672c5386dd87cf58742446a86b1
This commit is contained in:
48
src/net.cpp
48
src/net.cpp
@@ -2780,8 +2780,8 @@ int CConnman::GetBestHeight() const
|
||||
|
||||
unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; }
|
||||
|
||||
CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress& addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string& addrNameIn, bool fInboundIn) :
|
||||
nTimeConnected(GetSystemTimeInSeconds()),
|
||||
CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress& addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress& addrBindIn, const std::string& addrNameIn, bool fInboundIn)
|
||||
: nTimeConnected(GetSystemTimeInSeconds()),
|
||||
addr(addrIn),
|
||||
addrBind(addrBindIn),
|
||||
fInbound(fInboundIn),
|
||||
@@ -2791,56 +2791,14 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
||||
id(idIn),
|
||||
nLocalHostNonce(nLocalHostNonceIn),
|
||||
nLocalServices(nLocalServicesIn),
|
||||
nMyStartingHeight(nMyStartingHeightIn),
|
||||
nSendVersion(0)
|
||||
nMyStartingHeight(nMyStartingHeightIn)
|
||||
{
|
||||
nServices = NODE_NONE;
|
||||
hSocket = hSocketIn;
|
||||
nRecvVersion = INIT_PROTO_VERSION;
|
||||
nLastSend = 0;
|
||||
nLastRecv = 0;
|
||||
nSendBytes = 0;
|
||||
nRecvBytes = 0;
|
||||
nTimeOffset = 0;
|
||||
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
|
||||
nVersion = 0;
|
||||
strSubVer = "";
|
||||
fWhitelisted = false;
|
||||
fOneShot = false;
|
||||
m_manual_connection = false;
|
||||
fClient = false; // set by version message
|
||||
m_limited_node = false; // set by version message
|
||||
fFeeler = false;
|
||||
fSuccessfullyConnected = false;
|
||||
fDisconnect = false;
|
||||
nRefCount = 0;
|
||||
nSendSize = 0;
|
||||
nSendOffset = 0;
|
||||
hashContinue = uint256();
|
||||
nStartingHeight = -1;
|
||||
filterInventoryKnown.reset();
|
||||
fSendMempool = false;
|
||||
fGetAddr = false;
|
||||
nNextLocalAddrSend = 0;
|
||||
nNextAddrSend = 0;
|
||||
nNextInvSend = 0;
|
||||
fRelayTxes = false;
|
||||
fSentAddr = false;
|
||||
pfilter = MakeUnique<CBloomFilter>();
|
||||
timeLastMempoolReq = 0;
|
||||
nLastBlockTime = 0;
|
||||
nLastTXTime = 0;
|
||||
nPingNonceSent = 0;
|
||||
nPingUsecStart = 0;
|
||||
nPingUsecTime = 0;
|
||||
fPingQueued = false;
|
||||
nMinPingUsecTime = std::numeric_limits<int64_t>::max();
|
||||
minFeeFilter = 0;
|
||||
lastSentFeeFilter = 0;
|
||||
nextSendTimeFeeFilter = 0;
|
||||
fPauseRecv = false;
|
||||
fPauseSend = false;
|
||||
nProcessQueueSize = 0;
|
||||
|
||||
for (const std::string &msg : getAllNetMessageTypes())
|
||||
mapRecvBytesPerMsgCmd[msg] = 0;
|
||||
|
||||
Reference in New Issue
Block a user