From 5d1519e29bc609a22bf844a5168bff5cc849c392 Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Tue, 24 Apr 2018 10:11:40 -0700 Subject: [PATCH 1/7] move nStart closer to used and initialize it * Quells warning displayed with `-Wmaybe-uninitialized` flag --- src/init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 154aaa1aaa0ba..e60cd794e0856 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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()) @@ -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; From 7cce9fb0446703866e3085efca02327dc8d8d69c Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Thu, 26 Apr 2018 17:23:24 -0700 Subject: [PATCH 2/7] remove unused governance-misc.h file --- src/governance-misc.h | 52 ------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/governance-misc.h diff --git a/src/governance-misc.h b/src/governance-misc.h deleted file mode 100644 index d8bb03edbfaf5..0000000000000 --- a/src/governance-misc.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014-2017 The Dash Core developers - -// Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef GOVERNANCE_MISC_H -#define GOVERNANCE_MISC_H - -#include "validation.h" -#include "governance.h" -#include "init.h" - -class CGovernanceVote; - -/** -* Triggers and Settings - 12.2 -* ----------------------------------- -* -* This allows the network fine grained control of the p2p side, including but not limited to: -* - Which blocks are valid -* - What it costs to do various things on the network -* -*/ - - -// class CGovernanceTrigger -// { -// static &T IsBlockBanned(int n) -// { - -// } -// }; - -// /* - - -// */ - -// class CGovernanceSettings -// { -// template -// // strName=trigger, strParamater=ban-block ... obj= tigger.ban-block(args) -// static &T GetSetting(std::string strName, &T networkDefault) -// { -// /* -// - get setting from masternode network -// */ - -// return networkDefault; -// } -// }; - -#endif From c8f64747f71a2c27772117f9a6bb379b3a525684 Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Fri, 27 Apr 2018 19:08:46 -0700 Subject: [PATCH 3/7] remove old TODO comments --- src/governance-object.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/governance-object.cpp b/src/governance-object.cpp index 9fd4ca9c5dec3..9def59a753b2e 100644 --- a/src/governance-object.cpp +++ b/src/governance-object.cpp @@ -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 From dfff47754bfa7e103361002e7de1a84b19a2bef3 Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Tue, 24 Apr 2018 19:42:08 -0700 Subject: [PATCH 4/7] add devnet magic bytes to mininode.py --- qa/rpc-tests/test_framework/mininode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py index 3deff983cbd55..668326286f022 100755 --- a/qa/rpc-tests/test_framework/mininode.py +++ b/qa/rpc-tests/test_framework/mininode.py @@ -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): From 23aa079429582c205803d66c56af9052a8080c8b Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Sun, 22 Apr 2018 15:35:00 -0700 Subject: [PATCH 5/7] remove unused mnEntries vectors --- src/rpc/governance.cpp | 6 ------ src/rpc/masternode.cpp | 5 +---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index bb069eb33bee6..830e9f7cdcd6c 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -427,9 +427,6 @@ UniValue gobject(const JSONRPCRequest& request) int nSuccessful = 0; int nFailed = 0; - std::vector mnEntries; - mnEntries = masternodeConfig.getEntries(); - UniValue resultsObj(UniValue::VOBJ); for (const auto& mne : masternodeConfig.getEntries()) { @@ -539,9 +536,6 @@ UniValue gobject(const JSONRPCRequest& request) int nSuccessful = 0; int nFailed = 0; - std::vector mnEntries; - mnEntries = masternodeConfig.getEntries(); - UniValue resultsObj(UniValue::VOBJ); for (const auto& mne : masternodeConfig.getEntries()) diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index c773a73558982..f8c845c2090ac 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -770,9 +770,6 @@ UniValue masternodebroadcast(const JSONRPCRequest& request) EnsureWalletIsUnlocked(); } - std::vector mnEntries; - mnEntries = masternodeConfig.getEntries(); - int nSuccessful = 0; int nFailed = 0; @@ -946,4 +943,4 @@ void RegisterMasternodeRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); -} \ No newline at end of file +} From d7f876e86336170f2d6d3f20b6af26bcd0dc2b18 Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Fri, 27 Apr 2018 19:23:14 -0700 Subject: [PATCH 6/7] 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. --- src/instantx.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index e842288aaa60c..342ba3492eb8f 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -1150,10 +1150,7 @@ bool CTxLockVote::IsFailed() const bool COutPointLock::AddVote(const CTxLockVote& vote) { - if(mapMasternodeVotes.count(vote.GetMasternodeOutpoint())) - return false; - mapMasternodeVotes.insert(std::make_pair(vote.GetMasternodeOutpoint(), vote)); - return true; + return mapMasternodeVotes.emplace(std::make_pair(vote.GetMasternodeOutpoint(), vote)).second; } std::vector COutPointLock::GetVotes() const From 59c1ff0d84fa0363b43f48759e513d09cbb8f0bc Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Sun, 6 May 2018 15:45:04 -0700 Subject: [PATCH 7/7] Revert "replace map count/insert w/emplace in instantx.cpp" This reverts commit d7f876e86336170f2d6d3f20b6af26bcd0dc2b18. --- src/instantx.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index 342ba3492eb8f..e842288aaa60c 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -1150,7 +1150,10 @@ bool CTxLockVote::IsFailed() const bool COutPointLock::AddVote(const CTxLockVote& vote) { - return mapMasternodeVotes.emplace(std::make_pair(vote.GetMasternodeOutpoint(), vote)).second; + if(mapMasternodeVotes.count(vote.GetMasternodeOutpoint())) + return false; + mapMasternodeVotes.insert(std::make_pair(vote.GetMasternodeOutpoint(), vote)); + return true; } std::vector COutPointLock::GetVotes() const