Skip to content

Commit

Permalink
small cleanup in a few places (#2058)
Browse files Browse the repository at this point in the history
* move nStart closer to used and initialize it

* Quells warning displayed with `-Wmaybe-uninitialized` flag

* remove unused mnEntries vectors

* add devnet magic bytes to mininode.py

* remove unused governance-misc.h file

* remove old TODO comments

* replace map count/insert w/emplace in instantx.cpp

This feels like an optimization, something about:

```
if map.count(key)
     return false
else
     insert(pair)
     return true
```

... just feels icky. Plus, `vote.GetMasternodeOutpoint()` is only called
once. The previous version might be slightly more readable, however.

* Revert "replace map count/insert w/emplace in instantx.cpp"

This reverts commit d7f876e.
  • Loading branch information
nmarley authored and UdjinM6 committed May 13, 2018
1 parent ff93dd6 commit 41680f4
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 67 deletions.
1 change: 1 addition & 0 deletions qa/rpc-tests/test_framework/mininode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,7 @@ class NodeConn(asyncore.dispatcher):
"mainnet": b"\xbf\x0c\x6b\xbd", # mainnet
"testnet3": b"\xce\xe2\xca\xff", # testnet3
"regtest": b"\xfc\xc1\xb7\xdc", # regtest
"devnet": b"\xe2\xca\xff\xce", # devnet
}

def __init__(self, dstaddr, dstport, rpc, callback, net="regtest", services=NODE_NETWORK, send_version=True):
Expand Down
52 changes: 0 additions & 52 deletions src/governance-misc.h

This file was deleted.

3 changes: 0 additions & 3 deletions src/governance-object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,8 @@ void CGovernanceObject::UpdateSentinelVariables()

// CALCULATE THE MINUMUM VOTE COUNT REQUIRED FOR FULL SIGNAL

// todo - 12.1 - should be set to `10` after governance vote compression is implemented
int nAbsVoteReq = std::max(Params().GetConsensus().nGovernanceMinQuorum, nMnCount / 10);
int nAbsDeleteReq = std::max(Params().GetConsensus().nGovernanceMinQuorum, (2 * nMnCount) / 3);
// todo - 12.1 - Temporarily set to 1 for testing - reverted
//nAbsVoteReq = 1;

// SET SENTINEL FLAGS TO FALSE

Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,8 +1372,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(_("Unable to start HTTP server. See debug log for details."));
}

int64_t nStart;

// ********************************************************* Step 5: Backup wallet and verify wallet database integrity
#ifdef ENABLE_WALLET
if (!CWallet::InitAutoBackup())
Expand Down Expand Up @@ -1600,6 +1598,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of unused mempool space)\n", nCoinCacheUsage * (1.0 / 1024 / 1024), nMempoolSizeMax * (1.0 / 1024 / 1024));

bool fLoaded = false;
int64_t nStart = GetTimeMillis();

while (!fLoaded && !fRequestShutdown) {
bool fReset = fReindex;
std::string strLoadError;
Expand Down
6 changes: 0 additions & 6 deletions src/rpc/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,6 @@ UniValue gobject(const JSONRPCRequest& request)
int nSuccessful = 0;
int nFailed = 0;

std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
mnEntries = masternodeConfig.getEntries();

UniValue resultsObj(UniValue::VOBJ);

for (const auto& mne : masternodeConfig.getEntries()) {
Expand Down Expand Up @@ -539,9 +536,6 @@ UniValue gobject(const JSONRPCRequest& request)
int nSuccessful = 0;
int nFailed = 0;

std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
mnEntries = masternodeConfig.getEntries();

UniValue resultsObj(UniValue::VOBJ);

for (const auto& mne : masternodeConfig.getEntries())
Expand Down
5 changes: 1 addition & 4 deletions src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,6 @@ UniValue masternodebroadcast(const JSONRPCRequest& request)
EnsureWalletIsUnlocked();
}

std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
mnEntries = masternodeConfig.getEntries();

int nSuccessful = 0;
int nFailed = 0;

Expand Down Expand Up @@ -946,4 +943,4 @@ void RegisterMasternodeRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
}

0 comments on commit 41680f4

Please sign in to comment.