diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 11 | ||||
-rw-r--r-- | src/net.h | 2 | ||||
-rw-r--r-- | src/netaddress.cpp | 5 | ||||
-rw-r--r-- | src/netaddress.h | 1 | ||||
-rw-r--r-- | src/primitives/block.cpp | 5 | ||||
-rw-r--r-- | src/primitives/transaction.cpp | 19 | ||||
-rw-r--r-- | src/wallet/test/crypto_tests.cpp | 4 | ||||
-rw-r--r-- | src/warnings.cpp | 6 | ||||
-rw-r--r-- | src/warnings.h | 1 |
9 files changed, 19 insertions, 35 deletions
diff --git a/src/net.cpp b/src/net.cpp index 0994af3021..d4a36a0306 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2183,16 +2183,18 @@ void CConnman::SetNetworkActive(bool active) { LogPrint(BCLog::NET, "SetNetworkActive: %s\n", active); - if (!active) { - fNetworkActive = false; + if (fNetworkActive == active) { + return; + } + + fNetworkActive = active; + if (!fNetworkActive) { LOCK(cs_vNodes); // Close sockets to all nodes for (CNode* pnode : vNodes) { pnode->CloseSocketDisconnect(); } - } else { - fNetworkActive = true; } uiInterface.NotifyNetworkActiveChanged(fNetworkActive); @@ -2692,7 +2694,6 @@ int CConnman::GetBestHeight() const } unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; } -unsigned int CConnman::GetSendBufferSize() const{ return nSendBufferMaxSize; } 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()), @@ -242,8 +242,6 @@ public: bool DisconnectNode(const std::string& node); bool DisconnectNode(NodeId id); - unsigned int GetSendBufferSize() const; - ServiceFlags GetLocalServices() const; //!set the max outbound target in bytes diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 110e778fbd..f31b2fc49b 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -598,11 +598,6 @@ std::string CService::ToString() const return ToStringIPPort(); } -void CService::SetPort(unsigned short portIn) -{ - port = portIn; -} - CSubNet::CSubNet(): valid(false) { diff --git a/src/netaddress.h b/src/netaddress.h index 80716600d1..61afe0f1fe 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -148,7 +148,6 @@ class CService : public CNetAddr CService(const struct in_addr& ipv4Addr, unsigned short port); CService(const struct sockaddr_in& addr); void Init(); - void SetPort(unsigned short portIn); unsigned short GetPort() const; bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const; bool SetSockAddr(const struct sockaddr* paddr); diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 24be67c84f..3774ac3e4b 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -25,9 +25,8 @@ std::string CBlock::ToString() const hashMerkleRoot.ToString(), nTime, nBits, nNonce, vtx.size()); - for (unsigned int i = 0; i < vtx.size(); i++) - { - s << " " << vtx[i]->ToString() << "\n"; + for (const auto& tx : vtx) { + s << " " << tx->ToString() << "\n"; } return s.str(); } diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index f87934d586..9b6a814e1f 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -83,10 +83,9 @@ CTransaction::CTransaction(CMutableTransaction &&tx) : nVersion(tx.nVersion), vi CAmount CTransaction::GetValueOut() const { CAmount nValueOut = 0; - for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); ++it) - { - nValueOut += it->nValue; - if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) + for (const auto& tx_out : vout) { + nValueOut += tx_out.nValue; + if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut)) throw std::runtime_error(std::string(__func__) + ": value out of range"); } return nValueOut; @@ -106,11 +105,11 @@ std::string CTransaction::ToString() const vin.size(), vout.size(), nLockTime); - for (unsigned int i = 0; i < vin.size(); i++) - str += " " + vin[i].ToString() + "\n"; - for (unsigned int i = 0; i < vin.size(); i++) - str += " " + vin[i].scriptWitness.ToString() + "\n"; - for (unsigned int i = 0; i < vout.size(); i++) - str += " " + vout[i].ToString() + "\n"; + for (const auto& tx_in : vin) + str += " " + tx_in.ToString() + "\n"; + for (const auto& tx_in : vin) + str += " " + tx_in.scriptWitness.ToString() + "\n"; + for (const auto& tx_out : vout) + str += " " + tx_out.ToString() + "\n"; return str; } diff --git a/src/wallet/test/crypto_tests.cpp b/src/wallet/test/crypto_tests.cpp index 524a72c303..744063624c 100644 --- a/src/wallet/test/crypto_tests.cpp +++ b/src/wallet/test/crypto_tests.cpp @@ -26,8 +26,8 @@ bool OldSetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<u if (i != (int)WALLET_CRYPTO_KEY_SIZE) { - memory_cleanse(chKey, sizeof(chKey)); - memory_cleanse(chIV, sizeof(chIV)); + memory_cleanse(chKey, WALLET_CRYPTO_KEY_SIZE); + memory_cleanse(chIV, WALLET_CRYPTO_IV_SIZE); return false; } return true; diff --git a/src/warnings.cpp b/src/warnings.cpp index 2c1b1b0e12..75ccfeb116 100644 --- a/src/warnings.cpp +++ b/src/warnings.cpp @@ -37,12 +37,6 @@ void SetfLargeWorkInvalidChainFound(bool flag) fLargeWorkInvalidChainFound = flag; } -bool GetfLargeWorkInvalidChainFound() -{ - LOCK(cs_warnings); - return fLargeWorkInvalidChainFound; -} - std::string GetWarnings(const std::string& strFor) { std::string strStatusBar; diff --git a/src/warnings.h b/src/warnings.h index fd0ca53942..e8e982c0e3 100644 --- a/src/warnings.h +++ b/src/warnings.h @@ -13,7 +13,6 @@ void SetMiscWarning(const std::string& strWarning); void SetfLargeWorkForkFound(bool flag); bool GetfLargeWorkForkFound(); void SetfLargeWorkInvalidChainFound(bool flag); -bool GetfLargeWorkInvalidChainFound(); /** Format a string that describes several potential problems detected by the core. * strFor can have three values: * - "rpc": get critical warnings, which should put the client in safe mode if non-empty |