From a4ff2a19a719bd3c3ee5a9e4745139357b2344ef Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 28 Sep 2018 10:55:11 +0300 Subject: [PATCH] Fix some warnings and do a couple of other trivial cleanups (#2315) * Fix various warnings * A couple of trivial cleanups * fix 2320 --- src/activemasternode.cpp | 2 +- src/chainparams.cpp | 2 ++ src/dbwrapper.h | 1 + src/evo/providertx.cpp | 4 +++- src/governance.cpp | 2 +- src/hdchain.cpp | 4 ++-- src/net.cpp | 4 ++-- src/primitives/transaction.h | 2 +- src/privatesend-client.h | 7 ++++--- src/privatesend-server.cpp | 4 ++-- src/qt/forms/optionsdialog.ui | 2 +- src/qt/test/rpcnestedtests.cpp | 2 +- src/rpc/misc.cpp | 2 +- src/validation.cpp | 2 +- 14 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index ca2ac9665..844622f36 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -282,7 +282,7 @@ void CActiveLegacyMasternodeManager::ManageStateInitial(CConnman& connman) if(!fFoundLocal) { bool empty = true; // If we have some peers, let's try to find our local address from one of them - connman.ForEachNodeContinueIf(CConnman::AllNodes, [&fFoundLocal, &empty, this](CNode* pnode) { + connman.ForEachNodeContinueIf(CConnman::AllNodes, [&fFoundLocal, &empty](CNode* pnode) { empty = false; if (pnode->addr.IsIPv4()) fFoundLocal = GetLocal(activeMasternodeInfo.service, &pnode->addr) && CMasternode::IsValidNetAddr(activeMasternodeInfo.service); diff --git a/src/chainparams.cpp b/src/chainparams.cpp index d2a9da6db..1beccf7f0 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -361,6 +361,8 @@ public: assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7")); vFixedSeeds.clear(); + vFixedSeeds = std::vector(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test)); + vSeeds.clear(); // nodes with support for servicebits filtering should be at the top vSeeds.push_back(CDNSSeedData("dashdot.io", "testnet-seed.dashdot.io")); diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 240c6cfe4..500da8380 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -371,6 +371,7 @@ private: }; struct KeyValueHolder { + virtual ~KeyValueHolder() = default; virtual void Write(CDBBatch &batch) = 0; }; typedef std::unique_ptr KeyValueHolderPtr; diff --git a/src/evo/providertx.cpp b/src/evo/providertx.cpp index 08f6ba472..8ec449a13 100644 --- a/src/evo/providertx.cpp +++ b/src/evo/providertx.cpp @@ -228,7 +228,9 @@ bool CheckProUpRevTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CVal if (ptx.nVersion > CProRegTx::CURRENT_VERSION) return state.DoS(100, false, REJECT_INVALID, "bad-protx-version"); - if (ptx.nReason < CProUpRevTx::REASON_NOT_SPECIFIED || ptx.nReason > CProUpRevTx::REASON_LAST) + // ptx.nReason < CProUpRevTx::REASON_NOT_SPECIFIED is always `false` since + // ptx.nReason is unsigned and CProUpRevTx::REASON_NOT_SPECIFIED == 0 + if (ptx.nReason > CProUpRevTx::REASON_LAST) return state.DoS(100, false, REJECT_INVALID, "bad-protx-reason"); if (pindexPrev) { diff --git a/src/governance.cpp b/src/governance.cpp index f9f231f51..e69b5478d 100644 --- a/src/governance.cpp +++ b/src/governance.cpp @@ -1019,7 +1019,7 @@ void CGovernanceManager::RequestGovernanceObject(CNode* pfrom, const uint256& nH return; } - LogPrint("gobject", "CGovernanceObject::RequestGovernanceObject -- hash = %s (peer=%d)\n", nHash.ToString(), pfrom->GetId()); + LogPrint("gobject", "CGovernanceManager::RequestGovernanceObject -- nHash %s peer=%d\n", nHash.ToString(), pfrom->GetId()); CNetMsgMaker msgMaker(pfrom->GetSendVersion()); diff --git a/src/hdchain.cpp b/src/hdchain.cpp index 19bdc0e23..ae31a052a 100644 --- a/src/hdchain.cpp +++ b/src/hdchain.cpp @@ -169,9 +169,9 @@ void CHDChain::DeriveChildExtKey(uint32_t nAccountIndex, bool fInternal, uint32_ purposeKey.Derive(cointypeKey, Params().ExtCoinType() | 0x80000000); // derive m/purpose'/coin_type'/account' cointypeKey.Derive(accountKey, nAccountIndex | 0x80000000); - // derive m/purpose'/coin_type'/account/change + // derive m/purpose'/coin_type'/account'/change accountKey.Derive(changeKey, fInternal ? 1 : 0); - // derive m/purpose'/coin_type'/account/change/address_index + // derive m/purpose'/coin_type'/account'/change/address_index changeKey.Derive(extKeyRet, nChildIndex); } diff --git a/src/net.cpp b/src/net.cpp index 630ab50b5..d6d3841e7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2253,8 +2253,8 @@ void CConnman::SetNetworkActive(bool active) } CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In) : - nSeed0(nSeed0In), nSeed1(nSeed1In), - addrman(Params().AllowMultiplePorts()) + addrman(Params().AllowMultiplePorts()), + nSeed0(nSeed0In), nSeed1(nSeed1In) { fNetworkActive = true; setBannedIsDirty = false; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 30d957153..cfcd66afe 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -179,7 +179,7 @@ public: // "Dust" is defined in terms of CTransaction::minRelayTxFee, which has units duffs-per-kilobyte. // If you'd pay more than 1/3 in fees to spend something, then we consider it dust. // A typical spendable txout is 34 bytes big, and will need a CTxIn of at least 148 bytes to spend - // i.e. total is 148 + 32 = 182 bytes. Default -minrelaytxfee is 1000 duffs per kB + // i.e. total is 148 + 34 = 182 bytes. Default -minrelaytxfee is 1000 duffs per kB // and that means that fee per spendable txout is 182 * 1000 / 1000 = 182 duffs. // So dust is a spendable txout less than 546 * minRelayTxFee / 1000 (in duffs) // i.e. 182 * 3 = 546 duffs with default -minrelaytxfee = minRelayTxFee = 1000 duffs per kB. diff --git a/src/privatesend-client.h b/src/privatesend-client.h index f32db5611..c63f39754 100644 --- a/src/privatesend-client.h +++ b/src/privatesend-client.h @@ -53,12 +53,13 @@ public: addr(CService()), dsa(CDarksendAccept()), nTimeCreated(0) - {}; + {} CPendingDsaRequest(const CService& addr_, const CDarksendAccept& dsa_): addr(addr_), - dsa(dsa_) - { nTimeCreated = GetTime(); } + dsa(dsa_), + nTimeCreated(GetTime()) + {} CService GetAddr() { return addr; } CDarksendAccept GetDSA() { return dsa; } diff --git a/src/privatesend-server.cpp b/src/privatesend-server.cpp index b71d56c7a..4f7b76a38 100644 --- a/src/privatesend-server.cpp +++ b/src/privatesend-server.cpp @@ -431,7 +431,7 @@ void CPrivateSendServer::ChargeFees(CConnman& connman) std::random_shuffle(vecOffendersCollaterals.begin(), vecOffendersCollaterals.end()); if(nState == POOL_STATE_ACCEPTING_ENTRIES || nState == POOL_STATE_SIGNING) { - LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s\n", + LogPrintf("CPrivateSendServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s", (nState == POOL_STATE_SIGNING) ? "sign" : "send", vecOffendersCollaterals[0]->ToString()); LOCK(cs_main); @@ -716,7 +716,7 @@ bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessag if(!fUnitTest) { //broadcast that I'm accepting entries, only if it's the first entry through - CDarksendQueue dsq(dsa.nDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), false); + CDarksendQueue dsq(nSessionDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), false); LogPrint("privatesend", "CPrivateSendServer::CreateNewSession -- signing and relaying new queue: %s\n", dsq.ToString()); dsq.Sign(); dsq.Relay(connman); diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 8c9a4cfd9..f0cf50166 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -179,7 +179,7 @@ Show system popups for PrivateSend mixing transactions<br/>just like for all other transaction types. - Show popups for Privatesend transactions + Show popups for PrivateSend transactions diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index ef4ad3af1..eeba5d943 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -44,7 +44,7 @@ void RPCNestedTests::rpcNestedTests() RegisterAllCoreRPCCommands(tableRPC); tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]); ClearDatadirCache(); - std::string path = QDir::tempPath().toStdString() + "/" + strprintf("test_bitcoin_qt_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); + std::string path = QDir::tempPath().toStdString() + "/" + strprintf("test_dash_qt_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); QDir dir(QString::fromStdString(path)); dir.mkpath("."); ForceSetArg("-datadir", path); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 7c6f735f2..1c321b6ca 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -1157,7 +1157,7 @@ static const CRPCCommand commands[] = /* Not shown in help */ { "hidden", "setmocktime", &setmocktime, true, {"timestamp"}}, { "hidden", "echo", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, - { "hidden", "echojson", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, + { "hidden", "echojson", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, }; void RegisterMiscRPCCommands(CRPCTable &t) diff --git a/src/validation.cpp b/src/validation.cpp index e4c8a0518..bc5dd39a0 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -548,7 +548,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) if (tx.IsCoinBase()) { - int minCbSize = 2; + size_t minCbSize = 2; if (tx.nType == TRANSACTION_COINBASE) { // With the introduction of CbTx, coinbase scripts are not required anymore to hold a valid block height minCbSize = 1;