Skip to content

Commit

Permalink
Fix some warnings and do a couple of other trivial cleanups (#2315)
Browse files Browse the repository at this point in the history
* Fix various warnings

* A couple of trivial cleanups

* fix 2320
  • Loading branch information
UdjinM6 authored Sep 28, 2018
1 parent 5454bea commit a4ff2a1
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ class CTestNetParams : public CChainParams {
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"));
Expand Down
1 change: 1 addition & 0 deletions src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ class CDBTransaction {
};

struct KeyValueHolder {
virtual ~KeyValueHolder() = default;
virtual void Write(CDBBatch &batch) = 0;
};
typedef std::unique_ptr<KeyValueHolder> KeyValueHolderPtr;
Expand Down
4 changes: 3 additions & 1 deletion src/evo/providertx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 2 additions & 2 deletions src/hdchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class CTxOut
// "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.
Expand Down
7 changes: 4 additions & 3 deletions src/privatesend-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ class CPendingDsaRequest
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; }
Expand Down
4 changes: 2 additions & 2 deletions src/privatesend-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4ff2a1

Please sign in to comment.