Fix some warnings and do a couple of other trivial cleanups (#2315)

* Fix various warnings

* A couple of trivial cleanups

* fix 2320
This commit is contained in:
UdjinM6 2018-09-28 10:55:11 +03:00 committed by GitHub
parent 5454bea377
commit a4ff2a19a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 23 additions and 17 deletions

View File

@ -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);

View File

@ -361,6 +361,8 @@ public:
assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
vFixedSeeds.clear();
vFixedSeeds = std::vector<SeedSpec6>(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"));

View File

@ -371,6 +371,7 @@ private:
};
struct KeyValueHolder {
virtual ~KeyValueHolder() = default;
virtual void Write(CDBBatch &batch) = 0;
};
typedef std::unique_ptr<KeyValueHolder> KeyValueHolderPtr;

View File

@ -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) {

View File

@ -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());

View File

@ -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);
}

View File

@ -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;

View File

@ -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.

View File

@ -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; }

View File

@ -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);

View File

@ -179,7 +179,7 @@
<string>Show system popups for PrivateSend mixing transactions&lt;br/&gt;just like for all other transaction types.</string>
</property>
<property name="text">
<string>Show popups for Privatesend transactions</string>
<string>Show popups for PrivateSend transactions</string>
</property>
</widget>
</item>

View File

@ -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);

View File

@ -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)

View File

@ -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;