From 8ffdcbf9993856cb1083749ea2ca1d9cb35071da Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 30 Apr 2019 15:48:21 +0300 Subject: [PATCH] A bunch of mostly trivial tweaks/fixes (#2889) * Trivial: vout->txout * Re-use SetHexStr in few more places * Tweak log output * fix v13 release notes links * Drop no longer used stuff * Few more trivial fixes * Adjust few rpc help strings * Apply review suggestions --- doc/release-notes.md | 6 +++--- .../dash/release-notes-0.13.1.md | 2 +- .../dash/release-notes-0.13.2.md | 4 ++-- qa/rpc-tests/p2p-fullblocktest.py | 2 +- src/chainparams.cpp | 4 ++-- src/dsnotificationinterface.cpp | 6 +++--- src/evo/simplifiedmns.cpp | 2 +- src/governance-object.cpp | 6 +++--- src/governance.cpp | 4 ++-- src/init.cpp | 2 +- src/llmq/quorums.cpp | 2 +- src/llmq/quorums.h | 2 +- src/llmq/quorums_blockprocessor.cpp | 2 +- src/llmq/quorums_chainlocks.cpp | 4 ++-- src/llmq/quorums_chainlocks.h | 2 +- src/llmq/quorums_dkgsessionhandler.cpp | 2 +- src/llmq/quorums_dkgsessionhandler.h | 2 +- src/llmq/quorums_dkgsessionmgr.cpp | 4 ++-- src/llmq/quorums_dkgsessionmgr.h | 2 +- src/llmq/quorums_init.h | 2 -- src/llmq/quorums_signing_shares.cpp | 2 +- src/net.cpp | 2 +- src/privatesend-client.cpp | 21 ++++++++++++------- src/qt/overviewpage.cpp | 2 +- src/qt/trafficgraphwidget.cpp | 2 +- src/qt/transactiondesc.cpp | 10 ++++----- src/qt/transactionrecord.cpp | 2 +- src/qt/transactionview.cpp | 2 ++ src/rpc/governance.cpp | 4 ++-- src/rpc/rpcevo.cpp | 10 +++------ src/rpc/rpcquorums.cpp | 2 ++ src/spork.cpp | 6 ++---- src/util.cpp | 1 + src/utiltime.cpp | 15 ------------- src/utiltime.h | 1 - src/validation.cpp | 9 ++++---- 36 files changed, 70 insertions(+), 83 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 7b23ac4e9f..7795dbf8d2 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -120,9 +120,9 @@ Dash Core tree 0.12.1.x was a fork of Bitcoin Core tree 0.12. These release are considered obsolete. Old release notes can be found here: -- [v0.13.2.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.2.0.md) released Mar/15/2019 -- [v0.13.1.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.1.0.md) released Feb/9/2019 -- [v0.13.0.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.0.md) released Jan/14/2019 +- [v0.13.2](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.2.md) released Mar/15/2019 +- [v0.13.1](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.1.md) released Feb/9/2019 +- [v0.13.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.md) released Jan/14/2019 - [v0.12.3.4](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.4.md) released Dec/14/2018 - [v0.12.3.3](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.3.md) released Sep/19/2018 - [v0.12.3.2](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.2.md) released Jul/09/2018 diff --git a/doc/release-notes/dash/release-notes-0.13.1.md b/doc/release-notes/dash/release-notes-0.13.1.md index 84c033707e..4c1c115432 100644 --- a/doc/release-notes/dash/release-notes-0.13.1.md +++ b/doc/release-notes/dash/release-notes-0.13.1.md @@ -126,7 +126,7 @@ Dash Core tree 0.12.1.x was a fork of Bitcoin Core tree 0.12. These release are considered obsolete. Old release notes can be found here: -- [v0.13.0.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.0.md) released Jan/14/2019 +- [v0.13.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.md) released Jan/14/2019 - [v0.12.3.4](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.4.md) released Dec/14/2018 - [v0.12.3.3](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.3.md) released Sep/19/2018 - [v0.12.3.2](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.2.md) released Jul/09/2018 diff --git a/doc/release-notes/dash/release-notes-0.13.2.md b/doc/release-notes/dash/release-notes-0.13.2.md index 500ab253a3..39a563e00b 100644 --- a/doc/release-notes/dash/release-notes-0.13.2.md +++ b/doc/release-notes/dash/release-notes-0.13.2.md @@ -153,8 +153,8 @@ Dash Core tree 0.12.1.x was a fork of Bitcoin Core tree 0.12. These release are considered obsolete. Old release notes can be found here: -- [v0.13.1.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.1.0.md) released Feb/9/2019 -- [v0.13.0.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.0.md) released Jan/14/2019 +- [v0.13.1](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.1.md) released Feb/9/2019 +- [v0.13.0](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.13.0.md) released Jan/14/2019 - [v0.12.3.4](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.4.md) released Dec/14/2018 - [v0.12.3.3](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.3.md) released Sep/19/2018 - [v0.12.3.2](https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.12.3.2.md) released Jul/09/2018 diff --git a/qa/rpc-tests/p2p-fullblocktest.py b/qa/rpc-tests/p2p-fullblocktest.py index fab4bf71e4..90ec10758e 100755 --- a/qa/rpc-tests/p2p-fullblocktest.py +++ b/qa/rpc-tests/p2p-fullblocktest.py @@ -1245,7 +1245,7 @@ class FullBlockTest(ComparisonTestFramework): yield rejected() - # Test re-org of a week's worth of blocks (1088 blocks) + # Test re-org of a ~2 days' worth of blocks (1088 blocks) # This test takes a minute or two and can be accomplished in memory # if self.options.runbarelyexpensive: diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ee3f98c3e4..7336c92d95 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -442,7 +442,7 @@ public: consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 1553126400; // Mar 21st, 2019 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = 1584748800; // Mar 21st, 2020 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 100; - consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 50; // 80% of 100 + consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 50; // 50% of 100 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000000003cd72a542"); // 4000 @@ -601,7 +601,7 @@ public: consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 1553126400; // Mar 21st, 2019 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = 1584748800; // Mar 21st, 2020 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 100; - consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 50; // 80% of 100 + consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 50; // 50% of 100 // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000000000000000"); diff --git a/src/dsnotificationinterface.cpp b/src/dsnotificationinterface.cpp index 6017af97c1..e4c174336d 100644 --- a/src/dsnotificationinterface.cpp +++ b/src/dsnotificationinterface.cpp @@ -60,7 +60,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con return; llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew); - llmq::chainLocksHandler->UpdatedBlockTip(pindexNew, pindexFork); + llmq::chainLocksHandler->UpdatedBlockTip(pindexNew); CPrivateSend::UpdatedBlockTip(pindexNew); #ifdef ENABLE_WALLET @@ -68,8 +68,8 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con #endif // ENABLE_WALLET instantsend.UpdatedBlockTip(pindexNew); governance.UpdatedBlockTip(pindexNew, connman); - llmq::quorumManager->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload); - llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload); + llmq::quorumManager->UpdatedBlockTip(pindexNew, fInitialDownload); + llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, fInitialDownload); } void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) diff --git a/src/evo/simplifiedmns.cpp b/src/evo/simplifiedmns.cpp index 533ac8002d..d43b71741a 100644 --- a/src/evo/simplifiedmns.cpp +++ b/src/evo/simplifiedmns.cpp @@ -36,7 +36,7 @@ uint256 CSimplifiedMNListEntry::CalcHash() const std::string CSimplifiedMNListEntry::ToString() const { - return strprintf("CSimplifiedMNListEntry(proRegTxHash=%s, confirmedHash=%s, service=%s, pubKeyOperator=%s, votingAddress=%s, isValie=%d)", + return strprintf("CSimplifiedMNListEntry(proRegTxHash=%s, confirmedHash=%s, service=%s, pubKeyOperator=%s, votingAddress=%s, isValid=%d)", proRegTxHash.ToString(), confirmedHash.ToString(), service.ToString(false), pubKeyOperator.ToString(), CBitcoinAddress(keyIDVoting).ToString(), isValid); } diff --git a/src/governance-object.cpp b/src/governance-object.cpp index 54f00b420d..0b9cbe0878 100644 --- a/src/governance-object.cpp +++ b/src/governance-object.cpp @@ -495,14 +495,14 @@ bool CGovernanceObject::IsValidLocally(std::string& strError, bool& fMissingMast std::string strOutpoint = masternodeOutpoint.ToStringShort(); auto dmn = mnList.GetMNByCollateral(masternodeOutpoint); if (!dmn) { - strError = "Failed to find Masternode by UTXO, missing masternode=" + strOutpoint + "\n"; + strError = "Failed to find Masternode by UTXO, missing masternode=" + strOutpoint; return false; } if (!mnList.IsMNValid(dmn)) { if (mnList.IsMNPoSeBanned(dmn)) { - strError = "Masternode is POSE_BANNED, masternode=" + strOutpoint + "\n"; + strError = "Masternode is POSE_BANNED, masternode=" + strOutpoint; } else { - strError = "Masternode is invalid for unknown reason, masternode=" + strOutpoint + "\n"; + strError = "Masternode is invalid for unknown reason, masternode=" + strOutpoint; } return false; } diff --git a/src/governance.cpp b/src/governance.cpp index 5ce8ac5ee4..9b2b98af5d 100644 --- a/src/governance.cpp +++ b/src/governance.cpp @@ -183,7 +183,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm if (fRateCheckBypassed && (fIsValid || fMasternodeMissing)) { if (!MasternodeRateCheck(govobj, true)) { - LogPrintf("MNGOVERNANCEOBJECT -- masternode rate check failed (after signature verification) - %s - (current block height %d) \n", strHash, nCachedBlockHeight); + LogPrintf("MNGOVERNANCEOBJECT -- masternode rate check failed (after signature verification) - %s - (current block height %d)\n", strHash, nCachedBlockHeight); return; } } @@ -445,7 +445,7 @@ void CGovernanceManager::UpdateCachesAndClean() if (pObj->GetObjectType() == GOVERNANCE_OBJECT_PROPOSAL) { CProposalValidator validator(pObj->GetDataAsHexString(), true); if (!validator.Validate()) { - LogPrintf("CGovernanceManager::UpdateCachesAndClean -- set for deletion expired obj %s\n", (*it).first.ToString()); + LogPrintf("CGovernanceManager::UpdateCachesAndClean -- set for deletion expired obj %s\n", strHash); pObj->fCachedDelete = true; if (pObj->nDeletionTime == 0) { pObj->nDeletionTime = nNow; diff --git a/src/init.cpp b/src/init.cpp index e8010e359b..b1184a8705 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -801,7 +801,7 @@ void ThreadImport(std::vector vImportFiles) // scan for better chains in the block chain database, that are not yet connected in the active best chain CValidationState state; if (!ActivateBestChain(state, chainparams)) { - LogPrintf("Failed to connect best block"); + LogPrintf("Failed to connect best block (%s)\n", FormatStateMessage(state)); StartShutdown(); } diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index f22057a2e7..43718a79a3 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -159,7 +159,7 @@ CQuorumManager::CQuorumManager(CEvoDB& _evoDb, CBLSWorker& _blsWorker, CDKGSessi { } -void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) +void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload) { if (fInitialDownload) { return; diff --git a/src/llmq/quorums.h b/src/llmq/quorums.h index c78a8dc75b..8adaf5f440 100644 --- a/src/llmq/quorums.h +++ b/src/llmq/quorums.h @@ -92,7 +92,7 @@ private: public: CQuorumManager(CEvoDB& _evoDb, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager); - void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload); + void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload); bool HasQuorum(Consensus::LLMQType llmqType, const uint256& quorumHash); diff --git a/src/llmq/quorums_blockprocessor.cpp b/src/llmq/quorums_blockprocessor.cpp index a2df64d47d..eb0c3ba276 100644 --- a/src/llmq/quorums_blockprocessor.cpp +++ b/src/llmq/quorums_blockprocessor.cpp @@ -434,7 +434,7 @@ std::vector CQuorumBlockProcessor::GetMinedCommitmentsUntilB auto quorumIndex = pindex->GetAncestor(quorumHeight); assert(quorumIndex); - ret.emplace_back(pindex->GetAncestor(quorumHeight)); + ret.emplace_back(quorumIndex); dbIt->Next(); } diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index 9b67ef30c8..a2e3050d3d 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -184,7 +184,7 @@ void CChainLocksHandler::AcceptedBlockHeader(const CBlockIndex* pindexNew) } } -void CChainLocksHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork) +void CChainLocksHandler::UpdatedBlockTip(const CBlockIndex* pindexNew) { // don't call TrySignChainTip directly but instead let the scheduler call it. This way we ensure that cs_main is // never locked and TrySignChainTip is not called twice in parallel. Also avoids recursive calls due to @@ -301,7 +301,7 @@ void CChainLocksHandler::TrySignChainTip() auto it = blockTxs.find(pindexWalk->GetBlockHash()); if (it == blockTxs.end()) { // this should actually not happen as NewPoWValidBlock should have been called before - LogPrintf("CChainLocksHandler::%s -- blockTxs for %s not found\n", __func__, + LogPrint("chainlocks", "CChainLocksHandler::%s -- blockTxs for %s not found\n", __func__, pindexWalk->GetBlockHash().ToString()); return; } diff --git a/src/llmq/quorums_chainlocks.h b/src/llmq/quorums_chainlocks.h index 73a5e737d5..e057a25242 100644 --- a/src/llmq/quorums_chainlocks.h +++ b/src/llmq/quorums_chainlocks.h @@ -88,7 +88,7 @@ public: void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); void ProcessNewChainLock(NodeId from, const CChainLockSig& clsig, const uint256& hash); void AcceptedBlockHeader(const CBlockIndex* pindexNew); - void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork); + void UpdatedBlockTip(const CBlockIndex* pindexNew); void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock); void CheckActiveState(); void TrySignChainTip(); diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index 50c9957059..fbd5857b12 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -108,7 +108,7 @@ CDKGSessionHandler::~CDKGSessionHandler() } } -void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) +void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew) { LOCK(cs); diff --git a/src/llmq/quorums_dkgsessionhandler.h b/src/llmq/quorums_dkgsessionhandler.h index 4fba6c09e4..c297057e9c 100644 --- a/src/llmq/quorums_dkgsessionhandler.h +++ b/src/llmq/quorums_dkgsessionhandler.h @@ -121,7 +121,7 @@ public: CDKGSessionHandler(const Consensus::LLMQParams& _params, ctpl::thread_pool& _messageHandlerPool, CBLSWorker& blsWorker, CDKGSessionManager& _dkgManager); ~CDKGSessionHandler(); - void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload); + void UpdatedBlockTip(const CBlockIndex *pindexNew); void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); private: diff --git a/src/llmq/quorums_dkgsessionmgr.cpp b/src/llmq/quorums_dkgsessionmgr.cpp index 1e09181762..c68d95d00a 100644 --- a/src/llmq/quorums_dkgsessionmgr.cpp +++ b/src/llmq/quorums_dkgsessionmgr.cpp @@ -48,7 +48,7 @@ void CDKGSessionManager::StopMessageHandlerPool() messageHandlerPool.stop(true); } -void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) +void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload) { const auto& consensus = Params().GetConsensus(); @@ -62,7 +62,7 @@ void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBl return; for (auto& qt : dkgSessionHandlers) { - qt.second.UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload); + qt.second.UpdatedBlockTip(pindexNew); } } diff --git a/src/llmq/quorums_dkgsessionmgr.h b/src/llmq/quorums_dkgsessionmgr.h index 301fea934e..cfb9850ec0 100644 --- a/src/llmq/quorums_dkgsessionmgr.h +++ b/src/llmq/quorums_dkgsessionmgr.h @@ -53,7 +53,7 @@ public: void StartMessageHandlerPool(); void StopMessageHandlerPool(); - void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload); + void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload); void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); bool AlreadyHave(const CInv& inv) const; diff --git a/src/llmq/quorums_init.h b/src/llmq/quorums_init.h index c3a3112f98..3d094f017f 100644 --- a/src/llmq/quorums_init.h +++ b/src/llmq/quorums_init.h @@ -15,8 +15,6 @@ namespace llmq // If true, we will connect to all new quorums and watch their communication static const bool DEFAULT_WATCH_QUORUMS = false; -extern CDBWrapper* llmqDb; - // Init/destroy LLMQ globals void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests, bool fWipe = false); void DestroyLLMQSystem(); diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index d1c6f75ed0..2ab58707b0 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -1347,7 +1347,7 @@ void CSigSharesManager::WorkThreadMain() int64_t lastSendTime = 0; while (!workInterrupt) { - if (!quorumSigningManager || !g_connman || !quorumSigningManager) { + if (!quorumSigningManager || !g_connman) { if (!workInterrupt.sleep_for(std::chrono::milliseconds(100))) { return; } diff --git a/src/net.cpp b/src/net.cpp index 225f309708..79ca798297 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1156,7 +1156,7 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) { // don't accept incoming connections until fully synced if(fMasternodeMode && !masternodeSync.IsSynced()) { - LogPrintf("AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n"); + LogPrint("net", "AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n"); CloseSocket(hSocket); return; } diff --git a/src/privatesend-client.cpp b/src/privatesend-client.cpp index 12266fa875..ac539bbece 100644 --- a/src/privatesend-client.cpp +++ b/src/privatesend-client.cpp @@ -864,13 +864,20 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool CAmount nBalanceDenominatedUnconf = pwalletMain->GetDenominatedBalance(true); CAmount nBalanceDenominated = nBalanceDenominatedConf + nBalanceDenominatedUnconf; - LogPrint("privatesend", "CPrivateSendClientSession::DoAutomaticDenominating -- nValueMin: %f, nBalanceNeedsAnonymized: %f, nBalanceAnonimizableNonDenom: %f, nBalanceDenominatedConf: %f, nBalanceDenominatedUnconf: %f, nBalanceDenominated: %f\n", - (float)nValueMin / COIN, - (float)nBalanceNeedsAnonymized / COIN, - (float)nBalanceAnonimizableNonDenom / COIN, - (float)nBalanceDenominatedConf / COIN, - (float)nBalanceDenominatedUnconf / COIN, - (float)nBalanceDenominated / COIN); + LogPrint("privatesend", "CPrivateSendClientSession::DoAutomaticDenominating -- current stats:\n" + " nValueMin: %s\n" + " nBalanceNeedsAnonymized: %s\n" + " nBalanceAnonimizableNonDenom: %s\n" + " nBalanceDenominatedConf: %s\n" + " nBalanceDenominatedUnconf: %s\n" + " nBalanceDenominated: %s\n", + FormatMoney(nValueMin), + FormatMoney(nBalanceNeedsAnonymized), + FormatMoney(nBalanceAnonimizableNonDenom), + FormatMoney(nBalanceDenominatedConf), + FormatMoney(nBalanceDenominatedUnconf), + FormatMoney(nBalanceDenominated) + ); if (fDryRun) return true; diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 3025eb3e82..48a890d474 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -571,7 +571,7 @@ void OverviewPage::privateSendStatus() QString s = tr("Last PrivateSend message:\n") + strStatus; if(s != ui->labelPrivateSendLastMessage->text()) - LogPrintf("OverviewPage::privateSendStatus -- Last PrivateSend message: %s\n", strStatus.toStdString()); + LogPrint("privatesend", "OverviewPage::privateSendStatus -- Last PrivateSend message: %s\n", strStatus.toStdString()); ui->labelPrivateSendLastMessage->setText(s); diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index ebfa3e72cd..462f745c21 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -89,7 +89,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) // decide what order of magnitude we are int base = floor(log10(fMax)); float val = pow(10.0f, base); - float val2; + float val2 = val; const QString units = tr("KB/s"); const float yMarginText = 2.0; diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index a3814bc79f..1283cfa931 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -332,17 +332,17 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco { { strHTML += "
  • "; - const CTxOut &vout = prev.out; + const CTxOut& txout = prev.out; CTxDestination address; - if (ExtractDestination(vout.scriptPubKey, address)) + if (ExtractDestination(txout.scriptPubKey, address)) { if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty()) strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " "; strHTML += QString::fromStdString(CBitcoinAddress(address).ToString()); } - strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue); - strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")); - strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "
  • "; + strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, txout.nValue); + strHTML = strHTML + " IsMine=" + (wallet->IsMine(txout) & ISMINE_SPENDABLE ? tr("true") : tr("false")); + strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(txout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + ""; } } } diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index c00ca13ec2..f5ef214093 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -329,7 +329,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx, int numISLocks, int c if (wtx.isAbandoned()) status.status = TransactionStatus::Abandoned; } - else if (!wtx.IsChainLocked() && status.depth < RecommendedNumConfirmations) + else if (status.depth < RecommendedNumConfirmations && !wtx.IsChainLocked()) { status.status = TransactionStatus::Confirming; } diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 2b5814cd4d..7f2be564b5 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -423,6 +423,8 @@ void TransactionView::exportClicked() void TransactionView::contextualMenu(const QPoint &point) { + if (!transactionView || !transactionView->selectionModel()) + return; QModelIndex index = transactionView->indexAt(point); QModelIndexList selection = transactionView->selectionModel()->selectedRows(0); if (selection.empty()) diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index ce228ed0f1..5b9d14415e 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -562,7 +562,7 @@ UniValue gobject_vote_many(const JSONRPCRequest& request) void gobject_vote_alias_help(CWallet* const pwallet) { throw std::runtime_error( - "gobject vote-alias \n" + "gobject vote-alias \n" "Vote on a governance object by masternode's voting key (if present in local wallet)\n" + HelpRequiringPassphrase(pwallet) + "\n" "\nArguments:\n" @@ -887,7 +887,7 @@ UniValue gobject_getcurrentvotes(const JSONRPCRequest& request) " list - List governance objects (can be filtered by signal and/or object type)\n" " diff - List differences since last diff\n" #ifdef ENABLE_WALLET - " vote-alias - Vote on a governance object by masternode alias/proTxHash\n" + " vote-alias - Vote on a governance object by masternode proTxHash\n" #endif // ENABLE_WALLET " vote-conf - Vote on a governance object by masternode configured in dash.conf\n" #ifdef ENABLE_WALLET diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index 9dc6bfe901..7baf1444e4 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -140,21 +140,17 @@ static CKeyID ParsePubKeyIDFromAddress(const std::string& strAddress, const std: static CBLSPublicKey ParseBLSPubKey(const std::string& hexKey, const std::string& paramName) { - auto binKey = ParseHex(hexKey); CBLSPublicKey pubKey; - pubKey.SetBuf(binKey); - if (!pubKey.IsValid()) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a valid BLS address, not %s", paramName, hexKey)); + if (!pubKey.SetHexStr(hexKey)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a valid BLS public key, not %s", paramName, hexKey)); } return pubKey; } static CBLSSecretKey ParseBLSSecretKey(const std::string& hexKey, const std::string& paramName) { - auto binKey = ParseHex(hexKey); CBLSSecretKey secKey; - secKey.SetBuf(binKey); - if (!secKey.IsValid()) { + if (!secKey.SetHexStr(hexKey)) { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a valid BLS secret key", paramName)); } return secKey; diff --git a/src/rpc/rpcquorums.cpp b/src/rpc/rpcquorums.cpp index 029416a401..46d3d3f430 100644 --- a/src/rpc/rpcquorums.cpp +++ b/src/rpc/rpcquorums.cpp @@ -136,6 +136,8 @@ void quorum_dkgstatus_help() { throw std::runtime_error( "quorum dkgstatus (\"proTxHash\" detail_level)\n" + "Return the status of the current DKG process.\n" + "Works only when SPORK_17_QUORUM_DKG_ENABLED and SPORK_18_QUORUM_DEBUG_ENABLED sporks are ON.\n" "\nArguments:\n" "1. \"proTxHash\" (string, optional, default=\"\") ProTxHash of masternode to show status for.\n" " If set to an empty string, the local status is shown.\n" diff --git a/src/spork.cpp b/src/spork.cpp index 0a958d943e..13897daa7e 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -138,13 +138,11 @@ void CSporkManager::ProcessSpork(CNode* pfrom, const std::string& strCommand, CD CKeyID keyIDSigner; bool fSpork6IsActive = IsSporkActive(SPORK_6_NEW_SIGS); - if (!spork.GetSignerKeyID(keyIDSigner, fSpork6IsActive) - || !setSporkPubKeyIDs.count(keyIDSigner)) { + if (!spork.GetSignerKeyID(keyIDSigner, fSpork6IsActive) || !setSporkPubKeyIDs.count(keyIDSigner)) { // Note: unlike for other messages we have to check for new format even with SPORK_6_NEW_SIGS // inactive because SPORK_6_NEW_SIGS default is OFF and it is not the first spork to sync // (and even if it would, spork order can't be guaranteed anyway). - if (!spork.GetSignerKeyID(keyIDSigner, !fSpork6IsActive) - || !setSporkPubKeyIDs.count(keyIDSigner)) { + if (!spork.GetSignerKeyID(keyIDSigner, !fSpork6IsActive) || !setSporkPubKeyIDs.count(keyIDSigner)) { LOCK(cs_main); LogPrintf("CSporkManager::ProcessSpork -- ERROR: invalid signature\n"); Misbehaving(pfrom->GetId(), 100); diff --git a/src/util.cpp b/src/util.cpp index 0a8ae3029e..82bcf74e4d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -890,6 +890,7 @@ void RenameThread(const char* name) // Prevent warnings for unused parameters... (void)name; #endif + LogPrintf("%s: thread new name %s\n", __func__, name); } std::string GetThreadName() diff --git a/src/utiltime.cpp b/src/utiltime.cpp index 41c4f641e1..41714ceead 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -91,18 +91,3 @@ std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime) ss << boost::posix_time::from_time_t(nTime); return ss.str(); } - -std::string DurationToDHMS(int64_t nDurationTime) -{ - int seconds = nDurationTime % 60; - nDurationTime /= 60; - int minutes = nDurationTime % 60; - nDurationTime /= 60; - int hours = nDurationTime % 24; - int days = nDurationTime / 24; - if(days) - return strprintf("%dd %02dh:%02dm:%02ds", days, hours, minutes, seconds); - if(hours) - return strprintf("%02dh:%02dm:%02ds", hours, minutes, seconds); - return strprintf("%02dm:%02ds", minutes, seconds); -} diff --git a/src/utiltime.h b/src/utiltime.h index 91df8e707a..76c6673399 100644 --- a/src/utiltime.h +++ b/src/utiltime.h @@ -29,6 +29,5 @@ bool IsMockTime(); void MilliSleep(int64_t n); std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime); -std::string DurationToDHMS(int64_t nDurationTime); #endif // BITCOIN_UTILTIME_H diff --git a/src/validation.cpp b/src/validation.cpp index 02633b7245..8f4cd60dca 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -56,7 +56,6 @@ #include #include #include -#include #include #include @@ -2491,14 +2490,14 @@ void static UpdateTip(CBlockIndex *pindexNew, const CChainParams& chainParams) { } } } - LogPrintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)", __func__, + std::string strMessage = strprintf("%s: new best=%s height=%d version=0x%08x log2_work=%.8f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)", __func__, chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), chainActive.Tip()->nVersion, log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.Tip()->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), GuessVerificationProgress(chainParams.TxData(), chainActive.Tip()), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize()); if (!warningMessages.empty()) - LogPrintf(" warning='%s'", boost::algorithm::join(warningMessages, ", ")); - LogPrintf("\n"); + strMessage += strprintf(" warning='%s'", boost::algorithm::join(warningMessages, ", ")); + LogPrintf("%s\n", strMessage); } /** Disconnect chainActive's tip. You probably want to call mempool.removeForReorg and manually re-limit mempool size after this, with cs_main held. */ @@ -2603,7 +2602,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, if (!rv) { if (state.IsInvalid()) InvalidBlockFound(pindexNew, state); - return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); + return error("ConnectTip(): ConnectBlock %s failed with %s", pindexNew->GetBlockHash().ToString(), FormatStateMessage(state)); } nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001);