diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ecf821309e8b..e0b375df129c 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -406,7 +406,9 @@ class CMainParams : public CChainParams { nLLMQConnectionRetryTimeout = 60; nPoolMinParticipants = 3; - nPoolMaxParticipants = 5; // TODO: bump on next HF / mandatory upgrade + nPoolNewMinParticipants = 3; + nPoolMaxParticipants = 5; + nPoolNewMaxParticipants = 20; nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour vSporkAddresses = {"Xgtyuk76vhuFW2iT7UAiHgNdWXCf3J34wh"}; @@ -582,8 +584,10 @@ class CTestNetParams : public CChainParams { fAllowMultiplePorts = true; nLLMQConnectionRetryTimeout = 60; - nPoolMinParticipants = 3; // TODO drop to 2 with next mandatory upgrade + nPoolMinParticipants = 3; + nPoolNewMinParticipants = 2; nPoolMaxParticipants = 5; + nPoolNewMaxParticipants = 20; nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; @@ -740,8 +744,10 @@ class CDevNetParams : public CChainParams { fAllowMultiplePorts = true; nLLMQConnectionRetryTimeout = 60; - nPoolMinParticipants = 3; // same, drop to 2 w/ breaking change + nPoolMinParticipants = 3; + nPoolNewMinParticipants = 2; nPoolMaxParticipants = 5; + nPoolNewMaxParticipants = 20; nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; @@ -853,7 +859,9 @@ class CRegTestParams : public CChainParams { nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes nPoolMinParticipants = 2; + nPoolNewMinParticipants = 2; nPoolMaxParticipants = 5; + nPoolNewMaxParticipants = 20; // privKey: cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK vSporkAddresses = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"}; diff --git a/src/chainparams.h b/src/chainparams.h index aaae1262e016..3a216cb0fa14 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -89,7 +89,9 @@ class CChainParams void UpdateLLMQTestParams(int size, int threshold); void UpdateLLMQDevnetParams(int size, int threshold); int PoolMinParticipants() const { return nPoolMinParticipants; } + int PoolNewMinParticipants() const { return nPoolNewMinParticipants; } int PoolMaxParticipants() const { return nPoolMaxParticipants; } + int PoolNewMaxParticipants() const { return nPoolNewMaxParticipants; } int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; } const std::vector& SporkAddresses() const { return vSporkAddresses; } int MinSporkKeys() const { return nMinSporkKeys; } @@ -118,7 +120,9 @@ class CChainParams CCheckpointData checkpointData; ChainTxData chainTxData; int nPoolMinParticipants; + int nPoolNewMinParticipants; int nPoolMaxParticipants; + int nPoolNewMaxParticipants; int nFulfilledRequestExpireTime; std::vector vSporkAddresses; int nMinSporkKeys; diff --git a/src/dsnotificationinterface.cpp b/src/dsnotificationinterface.cpp index abde36373831..a6d8cbd7a6b0 100644 --- a/src/dsnotificationinterface.cpp +++ b/src/dsnotificationinterface.cpp @@ -65,15 +65,13 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con privateSendClient.UpdatedBlockTip(pindexNew); #endif // ENABLE_WALLET - if (fLiteMode) - return; - llmq::quorumInstantSendManager->UpdatedBlockTip(pindexNew); llmq::chainLocksHandler->UpdatedBlockTip(pindexNew); - governance.UpdatedBlockTip(pindexNew, connman); llmq::quorumManager->UpdatedBlockTip(pindexNew, fInitialDownload); llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, fInitialDownload); + + if (!fDisableGovernance) governance.UpdatedBlockTip(pindexNew, connman); } void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx, int64_t nAcceptTime) diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 21123648c23f..7cf59b58b5a7 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -670,9 +670,9 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C // has been reached, but the block hash will then point to the block at nMasternodeMinimumConfirmations int nConfirmations = pindexPrev->nHeight - dmn->pdmnState->nRegisteredHeight; if (nConfirmations >= Params().GetConsensus().nMasternodeMinimumConfirmations) { - CDeterministicMNState newState = *dmn->pdmnState; - newState.UpdateConfirmedHash(dmn->proTxHash, pindexPrev->GetBlockHash()); - newList.UpdateMN(dmn->proTxHash, std::make_shared(newState)); + auto newState = std::make_shared(*dmn->pdmnState); + newState->UpdateConfirmedHash(dmn->proTxHash, pindexPrev->GetBlockHash()); + newList.UpdateMN(dmn->proTxHash, newState); } }); @@ -730,17 +730,14 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C } dmn->nOperatorReward = proTx.nOperatorReward; - dmn->pdmnState = std::make_shared(proTx); - - CDeterministicMNState dmnState = *dmn->pdmnState; - dmnState.nRegisteredHeight = nHeight; + auto dmnState = std::make_shared(proTx); + dmnState->nRegisteredHeight = nHeight; if (proTx.addr == CService()) { // start in banned pdmnState as we need to wait for a ProUpServTx - dmnState.nPoSeBanHeight = nHeight; + dmnState->nPoSeBanHeight = nHeight; } - - dmn->pdmnState = std::make_shared(dmnState); + dmn->pdmnState = dmnState; newList.AddMN(dmn); diff --git a/src/evo/mnauth.cpp b/src/evo/mnauth.cpp index 7974633a4402..5fcd013cbb58 100644 --- a/src/evo/mnauth.cpp +++ b/src/evo/mnauth.cpp @@ -34,7 +34,15 @@ void CMNAuth::PushMNAUTH(CNode* pnode, CConnman& connman) // It does not protect against: // node1 -> Eve -> node2 // This is ok as we only use MNAUTH as a DoS protection and not for sensitive stuff - signHash = ::SerializeHash(std::make_tuple(*activeMasternodeInfo.blsPubKeyOperator, pnode->receivedMNAuthChallenge, pnode->fInbound)); + int nOurNodeVersion{PROTOCOL_VERSION}; + if (Params().NetworkIDString() != CBaseChainParams::MAIN && gArgs.IsArgSet("-pushversion")) { + nOurNodeVersion = gArgs.GetArg("-pushversion", PROTOCOL_VERSION); + } + if (pnode->nVersion < MNAUTH_NODE_VER_VERSION || nOurNodeVersion < MNAUTH_NODE_VER_VERSION) { + signHash = ::SerializeHash(std::make_tuple(*activeMasternodeInfo.blsPubKeyOperator, pnode->receivedMNAuthChallenge, pnode->fInbound)); + } else { + signHash = ::SerializeHash(std::make_tuple(*activeMasternodeInfo.blsPubKeyOperator, pnode->receivedMNAuthChallenge, pnode->fInbound, nOurNodeVersion)); + } } CMNAuth mnauth; @@ -102,8 +110,17 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS uint256 signHash; { LOCK(pnode->cs_mnauth); + int nOurNodeVersion{PROTOCOL_VERSION}; + if (Params().NetworkIDString() != CBaseChainParams::MAIN && gArgs.IsArgSet("-pushversion")) { + nOurNodeVersion = gArgs.GetArg("-pushversion", PROTOCOL_VERSION); + } // See comment in PushMNAUTH (fInbound is negated here as we're on the other side of the connection) - signHash = ::SerializeHash(std::make_tuple(dmn->pdmnState->pubKeyOperator, pnode->sentMNAuthChallenge, !pnode->fInbound)); + if (pnode->nVersion < MNAUTH_NODE_VER_VERSION || nOurNodeVersion < MNAUTH_NODE_VER_VERSION) { + signHash = ::SerializeHash(std::make_tuple(dmn->pdmnState->pubKeyOperator, pnode->sentMNAuthChallenge, !pnode->fInbound)); + } else { + signHash = ::SerializeHash(std::make_tuple(dmn->pdmnState->pubKeyOperator, pnode->sentMNAuthChallenge, !pnode->fInbound, pnode->nVersion.load())); + } + LogPrint(BCLog::NET_NETCONN, "CMNAuth::%s -- constructed signHash for nVersion %d, peer=%d\n", __func__, pnode->nVersion, pnode->GetId()); } if (!mnauth.sig.VerifyInsecure(dmn->pdmnState->pubKeyOperator.Get(), signHash)) { diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 6e3937b6c962..1f3e16da385f 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -87,8 +87,7 @@ bool CGovernanceManager::SerializeVoteForHash(const uint256& nHash, CDataStream& void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { - // lite mode is not supported - if (fLiteMode) return; + if (fDisableGovernance) return; if (!masternodeSync.IsBlockchainSynced()) return; // ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA @@ -547,7 +546,7 @@ struct sortProposalsByVotes { void CGovernanceManager::DoMaintenance(CConnman& connman) { - if (fLiteMode || !masternodeSync.IsSynced() || ShutdownRequested()) return; + if (fDisableGovernance || !masternodeSync.IsSynced() || ShutdownRequested()) return; // CHECK OBJECTS WE'VE ASKED FOR, REMOVE OLD ENTRIES diff --git a/src/init.cpp b/src/init.cpp index 94b3fb59495d..20c9f2546e14 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -268,16 +268,18 @@ void PrepareShutdown() // CValidationInterface callbacks, flush them... GetMainSignals().FlushBackgroundCallbacks(); - if (!fLiteMode && !fRPCInWarmup) { + if (!fRPCInWarmup) { // STORE DATA CACHES INTO SERIALIZED DAT FILES CFlatDB flatdb1("mncache.dat", "magicMasternodeCache"); flatdb1.Dump(mmetaman); - CFlatDB flatdb3("governance.dat", "magicGovernanceCache"); - flatdb3.Dump(governance); CFlatDB flatdb4("netfulfilled.dat", "magicFulfilledCache"); flatdb4.Dump(netfulfilledman); CFlatDB flatdb6("sporks.dat", "magicSporkCache"); flatdb6.Dump(sporkManager); + if (!fDisableGovernance) { + CFlatDB flatdb3("governance.dat", "magicGovernanceCache"); + flatdb3.Dump(governance); + } } // After the threads that potentially access these pointers have been stopped, @@ -490,7 +492,7 @@ std::string HelpMessage(HelpMessageMode mode) #ifndef WIN32 strUsage += HelpMessageOpt("-pid=", strprintf(_("Specify pid file. Relative paths will be prefixed by a net-specific datadir location. (default: %s)"), BITCOIN_PID_FILENAME)); #endif - strUsage += HelpMessageOpt("-prune=", strprintf(_("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -rescan. " + strUsage += HelpMessageOpt("-prune=", strprintf(_("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex, -rescan and -disablegovernance=false. " "Warning: Reverting this setting requires re-downloading the entire blockchain. " "(default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, >%u = automatically prune block files to stay under the specified target size in MiB)"), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); strUsage += HelpMessageOpt("-reindex-chainstate", _("Rebuild chain state from the currently indexed blocks")); @@ -614,7 +616,7 @@ std::string HelpMessage(HelpMessageMode mode) } strUsage += HelpMessageOpt("-shrinkdebugfile", _("Shrink debug.log file on client startup (default: 1 when no -debug)")); AppendParamsHelpMessages(strUsage, showDebug); - strUsage += HelpMessageOpt("-litemode", strprintf(_("Disable all Dash specific functionality (Masternodes, PrivateSend, InstantSend, Governance) (0-1, default: %u)"), 0)); + strUsage += HelpMessageOpt("-disablegovernance", strprintf(_("Disable governance validation (0-1, default: %u)"), 0)); strUsage += HelpMessageOpt("-sporkaddr=", strprintf(_("Override spork address. Only useful for regtest and devnet. Using this on mainnet or testnet will ban you."))); strUsage += HelpMessageOpt("-minsporkkeys=", strprintf(_("Overrides minimum spork signers to change spork value. Only useful for regtest and devnet. Using this on mainnet or testnet will ban you."))); @@ -980,6 +982,21 @@ void InitParameterInteraction() LogPrintf("%s: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1\n", __func__); } + if (gArgs.GetBoolArg("-litemode", false)) { + if (gArgs.SoftSetBoolArg("-disablegovernance", true)) { + LogPrintf("%s: parameter interaction: -litemode=true -> setting -disablegovernance=true\n", __func__); + } + } + + if (gArgs.GetArg("-prune", 0) > 0) { + if (gArgs.SoftSetBoolArg("-disablegovernance", true)) { + LogPrintf("%s: parameter interaction: -prune=%d -> setting -disablegovernance=true\n", __func__); + } + if (gArgs.SoftSetBoolArg("-txindex", false)) { + LogPrintf("%s: parameter interaction: -prune=%d -> setting -txindex=false\n", __func__); + } + } + // Make sure additional indexes are recalculated correctly in VerifyDB // (we must reconnect blocks whenever we disconnect them for these indexes to work) bool fAdditionalIndexes = @@ -1095,10 +1112,13 @@ bool AppInitParameterInteraction() // also see: InitParameterInteraction() - // if using block pruning, then disallow txindex + // if using block pruning, then disallow txindex and require disabling governance validation if (gArgs.GetArg("-prune", 0)) { if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX)) return InitError(_("Prune mode is incompatible with -txindex.")); + if (!gArgs.GetBoolArg("-disablegovernance", false)) { + return InitError(_("Prune mode is incompatible with -disablegovernance=false.")); + } } if (gArgs.IsArgSet("-devnet")) { @@ -1490,11 +1510,23 @@ bool AppInitParameterInteraction() if (gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) < DEFAULT_MAX_PEER_CONNECTIONS) { return InitError(strprintf("Masternode must be able to handle at least %d connections, set -maxconnections=%d", DEFAULT_MAX_PEER_CONNECTIONS, DEFAULT_MAX_PEER_CONNECTIONS)); } - if (gArgs.GetBoolArg("-litemode", false)) { - return InitError(_("You can not start a masternode in lite mode.")); + if (gArgs.GetBoolArg("-disablegovernance", false)) { + return InitError(_("You can not disable governance validation on a masternode.")); } } + if (gArgs.IsArgSet("-litemode")) { + InitWarning(_("-litemode is deprecated.") + (gArgs.GetBoolArg("-litemode", false) ? (" " + _("Its replacement -disablegovernance has been forced instead.")) : ( " " + _("It has been replaced by -disablegovernance.")))); + gArgs.ForceRemoveArg("-litemode"); + } + + fDisableGovernance = gArgs.GetBoolArg("-disablegovernance", false); + LogPrintf("fDisableGovernance %d\n", fDisableGovernance); + + if (fDisableGovernance) { + InitWarning(_("You are starting with governance validation disabled.") + (fPruneMode ? " " + _("This is expected because you are running a pruned node.") : "")); + } + return true; } @@ -1764,22 +1796,12 @@ bool AppInitMain() nMaxOutboundLimit = gArgs.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024; } - // ********************************************************* Step 7a: check lite mode and load sporks - - // lite mode disables all Dash-specific functionality - fLiteMode = gArgs.GetBoolArg("-litemode", false); - LogPrintf("fLiteMode %d\n", fLiteMode); + // ********************************************************* Step 7a: Load sporks - if(fLiteMode) { - InitWarning(_("You are starting in lite mode, most Dash-specific functionality is disabled.")); - } - - if (!fLiteMode) { - uiInterface.InitMessage(_("Loading sporks cache...")); - CFlatDB flatdb6("sporks.dat", "magicSporkCache"); - if (!flatdb6.Load(sporkManager)) { - return InitError(_("Failed to load sporks cache from") + "\n" + (GetDataDir() / "sporks.dat").string()); - } + uiInterface.InitMessage(_("Loading sporks cache...")); + CFlatDB flatdb6("sporks.dat", "magicSporkCache"); + if (!flatdb6.Load(sporkManager)) { + return InitError(_("Failed to load sporks cache from") + "\n" + (GetDataDir() / "sporks.dat").string()); } // ********************************************************* Step 7b: load block chain @@ -1853,9 +1875,9 @@ bool AppInitMain() break; } - if (!fLiteMode && !fTxIndex + if (!fDisableGovernance && !fTxIndex && chainparams.NetworkIDString() != CBaseChainParams::REGTEST) { // TODO remove this when pruning is fixed. See https://github.com/dashpay/dash/pull/1817 and https://github.com/dashpay/dash/pull/1743 - return InitError(_("Transaction index can't be disabled in full mode. Either start with -litemode command line switch or enable transaction index.")); + return InitError(_("Transaction index can't be disabled with governance validation enabled. Either start with -disablegovernance command line switch or enable transaction index.")); } // If the loaded chain has a wrong genesis, bail out immediately @@ -2093,7 +2115,7 @@ bool AppInitMain() // LOAD SERIALIZED DAT FILES INTO DATA CACHES FOR INTERNAL USE - bool fLoadCacheFiles = !(fLiteMode || fReindex || fReindexChainState); + bool fLoadCacheFiles = !(fReindex || fReindexChainState); { LOCK(cs_main); // was blocks/chainstate deleted? @@ -2121,7 +2143,7 @@ bool AppInitMain() strDBName = "governance.dat"; uiInterface.InitMessage(_("Loading governance cache...")); CFlatDB flatdb3(strDBName, "magicGovernanceCache"); - if (fLoadCacheFiles) { + if (fLoadCacheFiles && !fDisableGovernance) { if(!flatdb3.Load(governance)) { return InitError(_("Failed to load governance cache from") + "\n" + (pathDB / strDBName).string()); } @@ -2149,15 +2171,14 @@ bool AppInitMain() // ********************************************************* Step 10c: schedule Dash-specific tasks - if (!fLiteMode) { - scheduler.scheduleEvery(boost::bind(&CNetFulfilledRequestManager::DoMaintenance, boost::ref(netfulfilledman)), 60 * 1000); - scheduler.scheduleEvery(boost::bind(&CMasternodeSync::DoMaintenance, boost::ref(masternodeSync), boost::ref(*g_connman)), 1 * 1000); + scheduler.scheduleEvery(boost::bind(&CNetFulfilledRequestManager::DoMaintenance, boost::ref(netfulfilledman)), 60 * 1000); + scheduler.scheduleEvery(boost::bind(&CMasternodeSync::DoMaintenance, boost::ref(masternodeSync), boost::ref(*g_connman)), 1 * 1000); + scheduler.scheduleEvery(boost::bind(&CMasternodeUtils::DoMaintenance, boost::ref(*g_connman)), 1 * 1000); + if (!fDisableGovernance) { scheduler.scheduleEvery(boost::bind(&CGovernanceManager::DoMaintenance, boost::ref(governance), boost::ref(*g_connman)), 60 * 5 * 1000); } - scheduler.scheduleEvery(boost::bind(&CMasternodeUtils::DoMaintenance, boost::ref(*g_connman)), 1 * 1000); - if (fMasternodeMode) { scheduler.scheduleEvery(boost::bind(&CPrivateSendServer::DoMaintenance, boost::ref(privateSendServer), boost::ref(*g_connman)), 1 * 1000); } diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index 4384d19fc42f..410b4f0c7262 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -85,9 +85,8 @@ void CDKGPendingMessages::Clear() ////// -CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams& _params, ctpl::thread_pool& _messageHandlerPool, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager) : +CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager) : params(_params), - messageHandlerPool(_messageHandlerPool), blsWorker(_blsWorker), dkgManager(_dkgManager), curSession(std::make_shared(_params, _blsWorker, _dkgManager)), @@ -96,18 +95,13 @@ CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams& _params, ctp pendingJustifications((size_t)_params.size * 2, MSG_QUORUM_JUSTIFICATION), pendingPrematureCommitments((size_t)_params.size * 2, MSG_QUORUM_PREMATURE_COMMITMENT) { - phaseHandlerThread = std::thread([this] { - RenameThread(strprintf("dash-q-phase-%d", (uint8_t)params.type).c_str()); - PhaseHandlerThread(); - }); + if (params.type == Consensus::LLMQ_NONE) { + throw std::runtime_error("Can't initialize CDKGSessionHandler with LLMQ_NONE type."); + } } CDKGSessionHandler::~CDKGSessionHandler() { - stopRequested = true; - if (phaseHandlerThread.joinable()) { - phaseHandlerThread.join(); - } } void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew) @@ -146,6 +140,24 @@ void CDKGSessionHandler::ProcessMessage(CNode* pfrom, const std::string& strComm } } +void CDKGSessionHandler::StartThread() +{ + if (phaseHandlerThread.joinable()) { + throw std::runtime_error("Tried to start an already started CDKGSessionHandler thread."); + } + + std::string threadName = strprintf("q-phase-%d", params.type); + phaseHandlerThread = std::thread(&TraceThread >, threadName, std::function(std::bind(&CDKGSessionHandler::PhaseHandlerThread, this))); +} + +void CDKGSessionHandler::StopThread() +{ + stopRequested = true; + if (phaseHandlerThread.joinable()) { + phaseHandlerThread.join(); + } +} + bool CDKGSessionHandler::InitNewQuorum(const CBlockIndex* pindexQuorum) { //AssertLockHeld(cs_main); diff --git a/src/llmq/quorums_dkgsessionhandler.h b/src/llmq/quorums_dkgsessionhandler.h index 7ee399973bd8..1b7430ae2a42 100644 --- a/src/llmq/quorums_dkgsessionhandler.h +++ b/src/llmq/quorums_dkgsessionhandler.h @@ -103,7 +103,6 @@ class CDKGSessionHandler std::atomic stopRequested{false}; const Consensus::LLMQParams& params; - ctpl::thread_pool& messageHandlerPool; CBLSWorker& blsWorker; CDKGSessionManager& dkgManager; @@ -120,12 +119,15 @@ class CDKGSessionHandler CDKGPendingMessages pendingPrematureCommitments; public: - CDKGSessionHandler(const Consensus::LLMQParams& _params, ctpl::thread_pool& _messageHandlerPool, CBLSWorker& blsWorker, CDKGSessionManager& _dkgManager); + CDKGSessionHandler(const Consensus::LLMQParams& _params, CBLSWorker& blsWorker, CDKGSessionManager& _dkgManager); ~CDKGSessionHandler(); void UpdatedBlockTip(const CBlockIndex *pindexNew); void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); + void StartThread(); + void StopThread(); + private: bool InitNewQuorum(const CBlockIndex* pindexQuorum); diff --git a/src/llmq/quorums_dkgsessionmgr.cpp b/src/llmq/quorums_dkgsessionmgr.cpp index 705cba11bdb5..881209d68478 100644 --- a/src/llmq/quorums_dkgsessionmgr.cpp +++ b/src/llmq/quorums_dkgsessionmgr.cpp @@ -25,27 +25,29 @@ CDKGSessionManager::CDKGSessionManager(CDBWrapper& _llmqDb, CBLSWorker& _blsWork llmqDb(_llmqDb), blsWorker(_blsWorker) { + for (const auto& qt : Params().GetConsensus().llmqs) { + dkgSessionHandlers.emplace(std::piecewise_construct, + std::forward_as_tuple(qt.first), + std::forward_as_tuple(qt.second, blsWorker, *this)); + } } CDKGSessionManager::~CDKGSessionManager() { } -void CDKGSessionManager::StartMessageHandlerPool() +void CDKGSessionManager::StartThreads() { - for (const auto& qt : Params().GetConsensus().llmqs) { - dkgSessionHandlers.emplace(std::piecewise_construct, - std::forward_as_tuple(qt.first), - std::forward_as_tuple(qt.second, messageHandlerPool, blsWorker, *this)); + for (auto& it : dkgSessionHandlers) { + it.second.StartThread(); } - - messageHandlerPool.resize(2); - RenameThreadPool(messageHandlerPool, "dash-q-msg"); } -void CDKGSessionManager::StopMessageHandlerPool() +void CDKGSessionManager::StopThreads() { - messageHandlerPool.stop(true); + for (auto& it : dkgSessionHandlers) { + it.second.StopThread(); + } } void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload) diff --git a/src/llmq/quorums_dkgsessionmgr.h b/src/llmq/quorums_dkgsessionmgr.h index ca13475daf17..4e0d20d2f1ea 100644 --- a/src/llmq/quorums_dkgsessionmgr.h +++ b/src/llmq/quorums_dkgsessionmgr.h @@ -23,7 +23,6 @@ class CDKGSessionManager private: CDBWrapper& llmqDb; CBLSWorker& blsWorker; - ctpl::thread_pool messageHandlerPool; std::map dkgSessionHandlers; @@ -50,8 +49,8 @@ class CDKGSessionManager CDKGSessionManager(CDBWrapper& _llmqDb, CBLSWorker& _blsWorker); ~CDKGSessionManager(); - void StartMessageHandlerPool(); - void StopMessageHandlerPool(); + void StartThreads(); + void StopThreads(); void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload); diff --git a/src/llmq/quorums_init.cpp b/src/llmq/quorums_init.cpp index 23b8b5ebdc9d..85b412b8573f 100644 --- a/src/llmq/quorums_init.cpp +++ b/src/llmq/quorums_init.cpp @@ -70,7 +70,7 @@ void StartLLMQSystem() blsWorker->Start(); } if (quorumDKGSessionManager) { - quorumDKGSessionManager->StartMessageHandlerPool(); + quorumDKGSessionManager->StartThreads(); } if (quorumSigSharesManager) { quorumSigSharesManager->RegisterAsRecoveredSigsListener(); @@ -97,7 +97,7 @@ void StopLLMQSystem() quorumSigSharesManager->UnregisterAsRecoveredSigsListener(); } if (quorumDKGSessionManager) { - quorumDKGSessionManager->StopMessageHandlerPool(); + quorumDKGSessionManager->StopThreads(); } if (blsWorker) { blsWorker->Stop(); diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index dd8463df09c7..1b7c6b116aef 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -1609,7 +1609,7 @@ void CSigSharesManager::Sign(const CQuorumCPtr& quorum, const uint256& id, const // causes all known sigShares to be re-announced void CSigSharesManager::ForceReAnnouncement(const CQuorumCPtr& quorum, Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) { - if (!CLLMQUtils::IsAllMembersConnectedEnabled(llmqType)) { + if (CLLMQUtils::IsAllMembersConnectedEnabled(llmqType)) { return; } diff --git a/src/masternode/masternode-payments.cpp b/src/masternode/masternode-payments.cpp index 15f82b87e3f5..9bca61120362 100644 --- a/src/masternode/masternode-payments.cpp +++ b/src/masternode/masternode-payments.cpp @@ -116,7 +116,7 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar return false; } - if(!masternodeSync.IsSynced() || fLiteMode) { + if(!masternodeSync.IsSynced() || fDisableGovernance) { LogPrint(BCLog::MNPAYMENTS, "%s -- WARNING: Not enough data, checked superblock max bounds only\n", __func__); // not enough data for full checks but at least we know that the superblock limits were honored. // We rely on the network to have followed the correct chain in this case @@ -161,7 +161,7 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount blockReward) { - if(fLiteMode) { + if(fDisableGovernance) { //there is no budget data to use to check anything, let's just accept the longest chain LogPrint(BCLog::MNPAYMENTS, "%s -- WARNING: Not enough data, skipping block payee checks\n", __func__); return true; diff --git a/src/masternode/masternode-sync.cpp b/src/masternode/masternode-sync.cpp index d1de7d17ec0a..80ac79a714ff 100644 --- a/src/masternode/masternode-sync.cpp +++ b/src/masternode/masternode-sync.cpp @@ -230,6 +230,11 @@ void CMasternodeSync::ProcessTick(CConnman& connman) // GOVOBJ : SYNC GOVERNANCE ITEMS FROM OUR PEERS if(nCurrentAsset == MASTERNODE_SYNC_GOVERNANCE) { + if (fDisableGovernance) { + SwitchToNextAsset(connman); + connman.ReleaseNodeVector(vNodesCopy); + return; + } LogPrint(BCLog::GOBJECT, "CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d nTimeLastBumped %lld GetTime() %lld diff %lld\n", nTick, nCurrentAsset, nTimeLastBumped, GetTime(), GetTime() - nTimeLastBumped); // check for timeout first @@ -372,11 +377,6 @@ void CMasternodeSync::UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitia pindexNew->nHeight, pindexBestHeader->nHeight, fInitialDownload, fReachedBestHeader); if (!IsBlockchainSynced() && fReachedBestHeader) { - if (fLiteMode) { - // nothing to do in lite mode, just finish the process immediately - nCurrentAsset = MASTERNODE_SYNC_FINISHED; - return; - } // Reached best header while being in initial mode. // We must be at the tip already, let's move to the next asset. SwitchToNextAsset(connman); diff --git a/src/privatesend/privatesend-client.cpp b/src/privatesend/privatesend-client.cpp index 947a224aba4d..214b426471ad 100644 --- a/src/privatesend/privatesend-client.cpp +++ b/src/privatesend/privatesend-client.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -1504,8 +1505,15 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, std::vector vecSend; CKeyHolderStorage keyHolderStorageDenom; + CCoinControl coinControl; + // Every input will require at least this much fees in duffs + const CAmount nInputFee = GetMinimumFee(148, coinControl, ::mempool, ::feeEstimator, nullptr /* feeCalc */); + // Every output will require at least this much fees in duffs + const CAmount nOutputFee = GetMinimumFee(34, coinControl, ::mempool, ::feeEstimator, nullptr /* feeCalc */); + CAmount nValueLeft = tallyItem.nAmount; - nValueLeft -= CPrivateSend::GetCollateralAmount(); // leave some room for fees + // Leave some room for fees, assuming we are going to spend all the outpoints + nValueLeft -= tallyItem.vecOutPoints.size() * nInputFee; LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- 0 - %s nValueLeft: %f\n", EncodeDestination(tallyItem.txdest), (float)nValueLeft / COIN); @@ -1514,7 +1522,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, if (fCreateMixingCollaterals) { CScript scriptCollateral = keyHolderStorageDenom.AddKey(GetWallets()[0]); vecSend.push_back((CRecipient){scriptCollateral, CPrivateSend::GetMaxCollateralAmount(), false}); - nValueLeft -= CPrivateSend::GetMaxCollateralAmount(); + nValueLeft -= CPrivateSend::GetMaxCollateralAmount() + nOutputFee; } // ****** Add outputs for denoms ************ / @@ -1546,9 +1554,9 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, int nOutputs = 0; auto needMoreOutputs = [&]() { - bool fRegular = (nValueLeft >= nDenomValue && nBalanceToDenominate >= nDenomValue); + bool fRegular = ((nValueLeft >= nDenomValue + nOutputFee) && nBalanceToDenominate >= nDenomValue); bool fFinal = (fAddFinal - && nValueLeft >= nDenomValue + && nValueLeft >= nDenomValue + nOutputFee && nBalanceToDenominate > 0 && nBalanceToDenominate < nDenomValue); if (fFinal) { @@ -1570,7 +1578,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, // increment outputs and subtract denomination amount nOutputs++; currentDenomIt->second++; - nValueLeft -= nDenomValue; + nValueLeft -= nDenomValue + nOutputFee; nBalanceToDenominate -= nDenomValue; LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- 1 - nDenomValue: %f, totalOutputs: %d, nOutputsTotal: %d, nOutputs: %d, nValueLeft: %f, nBalanceToDenominate: %f\n", @@ -1585,7 +1593,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, for (const auto it : mapDenomCount) { // Check if this specific denom could use another loop, check that there aren't nPrivateSendDenomsGoal of this // denom and that our nValueLeft/nBalanceToDenominate is enough to create one of these denoms, if so, loop again. - if (it.second < privateSendClient.nPrivateSendDenomsGoal && nValueLeft >= it.first && nBalanceToDenominate > 0) { + if (it.second < privateSendClient.nPrivateSendDenomsGoal && (nValueLeft >= it.first + nOutputFee) && nBalanceToDenominate > 0) { finished = false; LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- 1 - NOT finished - nDenomValue: %f, count: %d, nValueLeft: %f, nBalanceToDenominate: %f\n", @@ -1601,7 +1609,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, } // Now that nPrivateSendDenomsGoal worth of each denom have been created or the max number of denoms given the value of the input, do something with the remainder. - if (nValueLeft >= CPrivateSend::GetSmallestDenomination() && nBalanceToDenominate >= CPrivateSend::GetSmallestDenomination() + if ((nValueLeft >= CPrivateSend::GetSmallestDenomination() + nOutputFee) && nBalanceToDenominate >= CPrivateSend::GetSmallestDenomination() && nOutputsTotal < PRIVATESEND_DENOM_OUTPUTS_THRESHOLD) { CAmount nLargestDenomValue = vecStandardDenoms.front(); @@ -1611,8 +1619,15 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, int nOutputs = 0; // Number of denoms we can create given our denom and the amount of funds we have left - int denomsToCreateValue = nValueLeft / nDenomValue; - int denomsToCreateBal = nBalanceToDenominate / nDenomValue; + int denomsToCreateValue = nValueLeft / (nDenomValue + nOutputFee); + // Prefer overshooting the targed balance by larger denoms (hence `+1`) instead of a more + // accurate approximation by many smaller denoms. This is ok because when we get here we + // should have nPrivateSendDenomsGoal of each smaller denom already. Also, without `+1` + // we can end up in a situation when there is already nPrivateSendDenomsHardCap of smaller + // denoms yet we can't mix the remaining nBalanceToDenominate because it's smaller than + // nDenomValue (and thus denomsToCreateBal == 0), so the target would never get reached + // even when there is enough funds for that. + int denomsToCreateBal = (nBalanceToDenominate / nDenomValue) + 1; // Use the smaller value int denomsToCreate = denomsToCreateValue > denomsToCreateBal ? denomsToCreateBal : denomsToCreateValue; auto it = mapDenomCount.find(nDenomValue); @@ -1626,7 +1641,7 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, // increment outputs and subtract denomination amount nOutputs++; it->second++; - nValueLeft -= nDenomValue; + nValueLeft -= nDenomValue + nOutputFee; nBalanceToDenominate -= nDenomValue; LogPrint(BCLog::PRIVATESEND, "CPrivateSendClientSession::CreateDenominated -- 2 - nDenomValue: %f, totalOutputs: %d, nOutputsTotal: %d, nOutputs: %d, nValueLeft: %f, nBalanceToDenominate: %f\n", @@ -1652,7 +1667,6 @@ bool CPrivateSendClientSession::CreateDenominated(CAmount nBalanceToDenominate, // if we have anything left over, it will be automatically send back as change - there is no need to send it manually - CCoinControl coinControl; coinControl.fAllowOtherInputs = false; coinControl.fAllowWatchOnly = false; coinControl.nCoinType = CoinType::ONLY_NONDENOMINATED; diff --git a/src/privatesend/privatesend-server.cpp b/src/privatesend/privatesend-server.cpp index 76780c9cfc8c..bfedf96357f5 100644 --- a/src/privatesend/privatesend-server.cpp +++ b/src/privatesend/privatesend-server.cpp @@ -27,7 +27,6 @@ CPrivateSendServer privateSendServer; void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { if (!fMasternodeMode) return; - if (fLiteMode) return; // ignore all Dash related functionality if (!masternodeSync.IsBlockchainSynced()) return; if (strCommand == NetMsgType::DSACCEPT) { @@ -870,7 +869,6 @@ void CPrivateSendServer::SetState(PoolState nStateNew) void CPrivateSendServer::DoMaintenance(CConnman& connman) { - if (fLiteMode) return; // disable all Dash specific functionality if (!fMasternodeMode) return; // only run on masternodes if (!masternodeSync.IsBlockchainSynced() || ShutdownRequested()) return; diff --git a/src/privatesend/privatesend.h b/src/privatesend/privatesend.h index f6ad5ecd60bb..caf154417dc7 100644 --- a/src/privatesend/privatesend.h +++ b/src/privatesend/privatesend.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -445,8 +446,12 @@ class CPrivateSend static std::string GetMessageByID(PoolMessage nMessageID); /// Get the minimum/maximum number of participants for the pool - static int GetMinPoolParticipants() { return Params().PoolMinParticipants(); } - static int GetMaxPoolParticipants() { return Params().PoolMaxParticipants(); } + static int GetMinPoolParticipants() { return sporkManager.IsSporkActive(SPORK_22_PS_MORE_PARTICIPANTS) ? + Params().PoolNewMinParticipants() : + Params().PoolMinParticipants(); } + static int GetMaxPoolParticipants() { return sporkManager.IsSporkActive(SPORK_22_PS_MORE_PARTICIPANTS) ? + Params().PoolNewMaxParticipants() : + Params().PoolMaxParticipants(); } static CAmount GetMaxPoolAmount() { return vecStandardDenominations.empty() ? 0 : PRIVATESEND_ENTRY_MAX_SIZE * vecStandardDenominations.front(); } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4da94010b4c7..1dcd16873840 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -366,7 +366,7 @@ void BitcoinGUI::createActions() #ifdef ENABLE_WALLET QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { + if (settings.value("fShowMasternodesTab").toBool()) { masternodeAction = new QAction(tr("&Masternodes"), this); masternodeAction->setStatusTip(tr("Browse masternodes")); masternodeAction->setToolTip(masternodeAction->statusTip()); @@ -594,8 +594,7 @@ void BitcoinGUI::createToolBars() toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction) - { + if (settings.value("fShowMasternodesTab").toBool() && masternodeAction) { toolbar->addAction(masternodeAction); } toolbar->setMovable(false); // remove unused icon in upper left corner @@ -767,7 +766,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) receiveCoinsMenuAction->setEnabled(enabled); historyAction->setEnabled(enabled); QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction) { + if (settings.value("fShowMasternodesTab").toBool() && masternodeAction) { masternodeAction->setEnabled(enabled); } encryptWalletAction->setEnabled(enabled); @@ -937,7 +936,7 @@ void BitcoinGUI::gotoHistoryPage() void BitcoinGUI::gotoMasternodePage() { QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction) { + if (settings.value("fShowMasternodesTab").toBool() && masternodeAction) { masternodeAction->setChecked(true); if (walletFrame) walletFrame->gotoMasternodePage(); } @@ -1126,7 +1125,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); tooltip += QString("
"); tooltip += tr("Transactions after this will not yet be visible."); - } else if (fLiteMode) { + } else if (fDisableGovernance) { setAdditionalDataSyncProgress(1); } diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index 4b86ebbe2503..342a950b7a69 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -393,7 +393,7 @@ BitcoinApplication::~BitcoinApplication() #endif // Delete Qt-settings if user clicked on "Reset Options" QSettings settings; - if(optionsModel && optionsModel->resetSettings){ + if(optionsModel && optionsModel->resetSettingsOnShutdown){ settings.clear(); settings.sync(); } diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 66cac99ce51b..f682fa1104e0 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -254,6 +254,7 @@ void OptionsDialog::on_resetButton_clicked() /* reset all options and close GUI */ model->Reset(); + model->resetSettingsOnShutdown = true; QApplication::quit(); } } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 440c9d60a996..fc6a27328935 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -52,8 +52,6 @@ void OptionsModel::Init(bool resetSettings) checkAndMigrate(); - this->resetSettings = resetSettings; - QSettings settings; // Ensure restart flag is unset on client startup @@ -226,7 +224,6 @@ void OptionsModel::Reset() // Remove all entries from our QSettings object settings.clear(); - resetSettings = true; // Needed in dash.cpp during shotdown to also remove the window positions // default setting for OptionsModel::StartAtStartup - disabled if (GUIUtil::GetStartOnSystemStartup()) diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 01a7181dad01..4afd3ab9fa98 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -84,7 +84,7 @@ class OptionsModel : public QAbstractListModel /* Restart flag helper */ void setRestartRequired(bool fRequired); bool isRestartRequired() const; - bool resetSettings; + bool resetSettingsOnShutdown{false}; private: /* Qt-only settings */ diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 25d40f587383..28516745aac1 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -149,7 +149,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")"); // hide PS frame (helps to preserve saved size) - // we'll setup and make it visible in updateAdvancedPSUI() later if we are not in litemode + // we'll setup and make it visible in updateAdvancedPSUI() later ui->framePrivateSend->setVisible(false); // start with displaying the "out of sync" warnings diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 3f4b5c579cbd..ec679c9fab92 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -81,7 +81,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): addWidget(sendCoinsPage); QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { + if (settings.value("fShowMasternodesTab").toBool()) { masternodeListPage = new MasternodeList(platformStyle); addWidget(masternodeListPage); } @@ -138,7 +138,7 @@ void WalletView::setClientModel(ClientModel *_clientModel) overviewPage->setClientModel(_clientModel); sendCoinsPage->setClientModel(_clientModel); QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { + if (settings.value("fShowMasternodesTab").toBool()) { masternodeListPage->setClientModel(_clientModel); } } @@ -151,7 +151,7 @@ void WalletView::setWalletModel(WalletModel *_walletModel) transactionView->setModel(_walletModel); overviewPage->setWalletModel(_walletModel); QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { + if (settings.value("fShowMasternodesTab").toBool()) { masternodeListPage->setWalletModel(_walletModel); } receiveCoinsPage->setModel(_walletModel); @@ -225,7 +225,7 @@ void WalletView::gotoHistoryPage() void WalletView::gotoMasternodePage() { QSettings settings; - if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { + if (settings.value("fShowMasternodesTab").toBool()) { setCurrentWidget(masternodeListPage); } } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ab67ab1545eb..bc0dc0cb9c9b 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -226,7 +226,6 @@ UniValue getbestchainlock(const JSONRPCRequest& request) throw std::runtime_error( "getbestchainlock\n" "\nReturns the block hash of the best chainlock. Throws an error if there is no known chainlock yet. " - "Will throw an error if running in litemode.\n" "\nResult:\n" "{\n" " \"blockhash\" : \"hash\", (string) The block hash hex encoded\n" @@ -239,10 +238,6 @@ UniValue getbestchainlock(const JSONRPCRequest& request) ); UniValue result(UniValue::VOBJ); - if (fLiteMode) { - throw JSONRPCError(RPC_INTERNAL_ERROR, "Chainlock information not available in litemode."); - } - llmq::CChainLockSig clsig = llmq::chainLocksHandler->GetBestChainLock(); if (clsig.IsNull()) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to find any chainlock"); @@ -419,7 +414,7 @@ std::string EntryDescriptionString() " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ],\n" - " \"instantlock\" : true|false (boolean) True if this transaction was locked via InstantSend. Always false if litemode is enabled\n"; + " \"instantlock\" : true|false (boolean) True if this transaction was locked via InstantSend\n"; } void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) @@ -1681,7 +1676,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request) " \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n" " \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n" " \"minrelaytxfee\": xxxxx (numeric) Current minimum relay fee for transactions\n" - " \"instantsendlocks\": xxxxx, (numeric) Number of unconfirmed instant send locks. Always 0 if litemode is enabled\n" + " \"instantsendlocks\": xxxxx, (numeric) Number of unconfirmed instant send locks\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolinfo", "") diff --git a/src/rpc/privatesend.cpp b/src/rpc/privatesend.cpp index 55f7e28fdc68..56e358e79c08 100644 --- a/src/rpc/privatesend.cpp +++ b/src/rpc/privatesend.cpp @@ -36,14 +36,11 @@ UniValue privatesend(const JSONRPCRequest& request) throw JSONRPCError(RPC_INTERNAL_ERROR, "Client-side mixing is not supported on masternodes"); if (!privateSendClient.fEnablePrivateSend) { - if (fLiteMode) { - // mixing is disabled by default in lite mode - throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled in lite mode, use -enableprivatesend command line option to enable mixing again"); - } else if (!gArgs.GetBoolArg("-enableprivatesend", true)) { + if (!gArgs.GetBoolArg("-enableprivatesend", true)) { // otherwise it's on by default, unless cmd line option says otherwise throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled via -enableprivatesend=0 command line option, remove it to enable mixing again"); } else { - // neither litemode nor enableprivatesend=false case, + // not enableprivatesend=false case, // most likely something bad happened and we disabled it while running the wallet throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled due to some internal error"); } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 71d5b0e86f03..6b9c554ca0a3 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -171,9 +171,9 @@ UniValue getrawtransaction(const JSONRPCRequest& request) " \"confirmations\" : n, (numeric) The confirmations\n" " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n" " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" - " \"instantlock\" : true|false, (bool) Current transaction lock state. Always false if litemode is enabled\n" - " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Always false if litemode is enabled\n" - " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n" + " \"instantlock\" : true|false, (bool) Current transaction lock state\n" + " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n" + " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n" "}\n" "\nExamples:\n" diff --git a/src/rpc/rpcevo.cpp b/src/rpc/rpcevo.cpp index 9f18ad322af7..bed3847cb164 100644 --- a/src/rpc/rpcevo.cpp +++ b/src/rpc/rpcevo.cpp @@ -62,7 +62,7 @@ std::string GetHelpString(int nParamNum, std::string strParamName) " Must be unique on the network. Can be set to 0, which will require a ProUpServTx afterwards.\n" }, {"operatorKey", - "%d. \"operatorKey\" (string, required) The operator private key belonging to the\n" + "%d. \"operatorKey\" (string, required) The operator BLS private key associated with the\n" " registered operator public key.\n" }, {"operatorPayoutAddress", @@ -71,12 +71,12 @@ std::string GetHelpString(int nParamNum, std::string strParamName) " If set to an empty string, the currently active payout address is reused.\n" }, {"operatorPubKey_register", - "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The private key does not have to be known.\n" - " It has to match the private key which is later used when operating the masternode.\n" + "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The BLS private key does not have to be known.\n" + " It has to match the BLS private key which is later used when operating the masternode.\n" }, {"operatorPubKey_update", - "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The private key does not have to be known.\n" - " It has to match the private key which is later used when operating the masternode.\n" + "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The BLS private key does not have to be known.\n" + " It has to match the BLS private key which is later used when operating the masternode.\n" " If set to an empty string, the currently active operator BLS public key is reused.\n" }, {"operatorReward", @@ -227,7 +227,7 @@ static void FundSpecialTx(CWallet* pwallet, CMutableTransaction& tx, const Speci } if (!coinControl.HasSelected()) { - throw JSONRPCError(RPC_INTERNAL_ERROR, "No funds at specified address"); + throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("No funds at specified address %s", EncodeDestination(fundDest))); } CWalletTx wtx; diff --git a/src/spork.cpp b/src/spork.cpp index 0ac2a16de57c..16c41d6d0429 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -24,6 +24,7 @@ std::vector sporkDefs = { MAKE_SPORK_DEF(SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF + MAKE_SPORK_DEF(SPORK_22_PS_MORE_PARTICIPANTS, 4070908800ULL), // OFF }; CSporkManager sporkManager; @@ -116,7 +117,6 @@ void CSporkManager::CheckAndRemove() void CSporkManager::ProcessSpork(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { - if(fLiteMode) return; // disable all Dash specific functionality if (strCommand == NetMsgType::SPORK) { diff --git a/src/spork.h b/src/spork.h index b0ff6ff78436..e5142f3b6ad0 100644 --- a/src/spork.h +++ b/src/spork.h @@ -28,6 +28,7 @@ enum SporkId : int32_t { SPORK_17_QUORUM_DKG_ENABLED = 10016, SPORK_19_CHAINLOCKS_ENABLED = 10018, SPORK_21_QUORUM_ALL_CONNECTED = 10020, + SPORK_22_PS_MORE_PARTICIPANTS = 10021, SPORK_INVALID = -1, }; diff --git a/src/stacktraces.cpp b/src/stacktraces.cpp index dfe970ba6053..020b7fee2be9 100644 --- a/src/stacktraces.cpp +++ b/src/stacktraces.cpp @@ -690,32 +690,34 @@ crash_info GetCrashInfoFromException(const std::exception_ptr& e) std::string type; std::string what; + auto getExceptionType = [&]() -> std::string { + auto type = abi::__cxa_current_exception_type(); + if (type && (strlen(type->name()) > 0)) { + return DemangleSymbol(type->name()); + } + return ""; + }; + try { // rethrow and catch the exception as there is no other way to reliably cast to the real type (not possible with RTTI) std::rethrow_exception(e); } catch (const std::exception& e) { - type = abi::__cxa_current_exception_type()->name(); + type = getExceptionType(); what = GetExceptionWhat(e); } catch (const std::string& e) { - type = abi::__cxa_current_exception_type()->name(); + type = getExceptionType(); what = GetExceptionWhat(e); } catch (const char* e) { - type = abi::__cxa_current_exception_type()->name(); + type = getExceptionType(); what = GetExceptionWhat(e); } catch (int e) { - type = abi::__cxa_current_exception_type()->name(); + type = getExceptionType(); what = GetExceptionWhat(e); } catch (...) { - type = abi::__cxa_current_exception_type()->name(); + type = getExceptionType(); what = ""; } - if (type.empty()) { - type = ""; - } else { - type = DemangleSymbol(type); - } - ci.crashDescription += strprintf("type=%s, what=\"%s\"", type, what); auto stackframes = GetExceptionStacktrace(e); diff --git a/src/util.cpp b/src/util.cpp index b58007b70243..c76ad47e54f1 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -91,7 +91,7 @@ const int64_t nStartupTime = GetTime(); //Dash only features bool fMasternodeMode = false; -bool fLiteMode = false; +bool fDisableGovernance = false; /** nWalletBackups: 1..10 - number of automatic backups to keep @@ -888,14 +888,9 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message std::string("\n\n"); } -static std::string FormatException(const std::exception_ptr pex, const char* pszThread) +void PrintExceptionContinue(const std::exception_ptr pex, const char* pszExceptionOrigin) { - return GetPrettyExceptionStr(pex); -} - -void PrintExceptionContinue(const std::exception_ptr pex, const char* pszThread) -{ - std::string message = FormatException(pex, pszThread); + std::string message = strprintf("\"%s\" raised an exception\n%s", pszExceptionOrigin, GetPrettyExceptionStr(pex)); LogPrintf("\n\n************************\n%s\n", message); fprintf(stderr, "\n\n************************\n%s\n", message.c_str()); } diff --git a/src/util.h b/src/util.h index ab650795cc13..35a1a695a15b 100644 --- a/src/util.h +++ b/src/util.h @@ -50,7 +50,7 @@ //Dash only features extern bool fMasternodeMode; -extern bool fLiteMode; +extern bool fDisableGovernance; extern int nWalletBackups; // Application startup time (used for uptime calculation) @@ -225,7 +225,7 @@ bool error(const char* fmt, const Args&... args) return false; } -void PrintExceptionContinue(const std::exception_ptr pex, const char* pszThread); +void PrintExceptionContinue(const std::exception_ptr pex, const char* pszExceptionOrigin); void FileCommit(FILE *file); bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); @@ -433,9 +433,9 @@ void RenameThreadPool(ctpl::thread_pool& tp, const char* baseName); /** * .. and a wrapper that just calls func once */ -template void TraceThread(const char* name, Callable func) +template void TraceThread(const std::string name, Callable func) { - std::string s = strprintf("dash-%s", name); + std::string s = "dash-" + name; RenameThread(s.c_str()); try { @@ -449,7 +449,7 @@ template void TraceThread(const char* name, Callable func) throw; } catch (...) { - PrintExceptionContinue(std::current_exception(), name); + PrintExceptionContinue(std::current_exception(), name.c_str()); throw; } } diff --git a/src/validation.cpp b/src/validation.cpp index 2711359de2a3..9f6c4fa54369 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -977,6 +977,9 @@ bool GetTransaction(const uint256& hash, CTransactionRef& txOut, const Consensus hashBlock = header.GetHash(); if (txOut->GetHash() != hash) return error("%s: txid mismatch", __func__); + if (!mapBlockIndex.count(hashBlock)) { + return error("%s: hashBlock %s not in mapBlockIndex", __func__, hashBlock.ToString()); + } return true; } diff --git a/src/version.h b/src/version.h index 9614172cf0de..279ee4546dad 100644 --- a/src/version.h +++ b/src/version.h @@ -11,7 +11,7 @@ */ -static const int PROTOCOL_VERSION = 70217; +static const int PROTOCOL_VERSION = 70218; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -23,7 +23,7 @@ static const int GETHEADERS_VERSION = 70077; static const int MIN_PEER_PROTO_VERSION = 70213; //! minimum proto version of masternode to accept in DKGs -static const int MIN_MASTERNODE_PROTO_VERSION = 70217; +static const int MIN_MASTERNODE_PROTO_VERSION = 70218; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this @@ -54,4 +54,7 @@ static const int LLMQS_PROTO_VERSION = 70214; //! TODO we can remove this in 0.15.0.0 static const int SENDDSQUEUE_PROTO_VERSION = 70214; +//! protocol version is included in MNAUTH starting with this version +static const int MNAUTH_NODE_VER_VERSION = 70218; + #endif // BITCOIN_VERSION_H diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index f60df09f4957..0d764ed2db8f 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -410,7 +410,7 @@ void WalletInit::InitPrivateSendSettings() if (!HasWallets()) { privateSendClient.fEnablePrivateSend = privateSendClient.fPrivateSendRunning = false; } else { - privateSendClient.fEnablePrivateSend = gArgs.GetBoolArg("-enableprivatesend", !fLiteMode); + privateSendClient.fEnablePrivateSend = gArgs.GetBoolArg("-enableprivatesend", true); privateSendClient.fPrivateSendRunning = GetWallets()[0]->IsLocked() ? false : gArgs.GetBoolArg("-privatesendautostart", DEFAULT_PRIVATESEND_AUTOSTART); } privateSendClient.fPrivateSendMultiSession = gArgs.GetBoolArg("-privatesendmultisession", DEFAULT_PRIVATESEND_MULTISESSION); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 48242df523c9..2f1a72d99a10 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1677,9 +1677,9 @@ UniValue listtransactions(const JSONRPCRequest& request) " \"confirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and \n" " 'receive' category of transactions. Negative confirmations indicate the\n" " transation conflicts with the block chain\n" - " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n" - " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n" - " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n" + " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions\n" + " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions\n" + " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n" " \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n" " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n" " category of transactions.\n" @@ -1900,9 +1900,9 @@ UniValue listsinceblock(const JSONRPCRequest& request) " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n" " \"confirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n" " When it's < 0, it means the transaction conflicted that many blocks ago.\n" - " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n" - " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n" - " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n" + " \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions\n" + " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions\n" + " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n" " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n" " \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive' category of transactions.\n" " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n" @@ -2031,9 +2031,9 @@ UniValue gettransaction(const JSONRPCRequest& request) " \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n" " \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" " 'send' category of transactions.\n" - " \"instantlock\" : true|false, (bool) Current transaction lock state. Always false if litemode is enabled\n" - " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Always false if litemode is enabled\n" - " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n" + " \"instantlock\" : true|false, (bool) Current transaction lock state\n" + " \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n" + " \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n" " \"confirmations\" : n, (numeric) The number of blockchain confirmations\n" " \"blockhash\" : \"hash\", (string) The block hash\n" " \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n" @@ -2935,6 +2935,12 @@ UniValue loadwallet(const JSONRPCRequest& request) fs::path wallet_path = fs::absolute(wallet_file, GetWalletDir()); if (fs::symlink_status(wallet_path).type() == fs::file_not_found) { throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + wallet_file + " not found."); + } else if (fs::is_directory(wallet_path)) { + // The given filename is a directory. Check that there's a wallet.dat file. + fs::path wallet_dat_file = wallet_path / "wallet.dat"; + if (fs::symlink_status(wallet_dat_file).type() == fs::file_not_found) { + throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Directory " + wallet_file + " does not contain a wallet.dat file."); + } } std::string warning; diff --git a/test/functional/blockchain.py b/test/functional/blockchain.py index 0dbc45f6aa0c..2e60eb73a795 100755 --- a/test/functional/blockchain.py +++ b/test/functional/blockchain.py @@ -21,6 +21,7 @@ from decimal import Decimal import http.client import subprocess +import sys from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( @@ -37,6 +38,7 @@ class BlockchainTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True + self.stderr = sys.stdout self.extra_args = [['-stopatheight=207', '-prune=1', '-txindex=0']] def run_test(self): diff --git a/test/functional/import-rescan.py b/test/functional/import-rescan.py index 938989d9720d..791b668e4841 100755 --- a/test/functional/import-rescan.py +++ b/test/functional/import-rescan.py @@ -126,7 +126,7 @@ def setup_network(self): # txindex is enabled by default in Dash and needs to be disabled for import-rescan.py extra_args[i] += ["-prune=1", "-txindex=0", "-reindex"] - self.add_nodes(self.num_nodes, extra_args) + self.add_nodes(self.num_nodes, extra_args, stderr=sys.stdout) self.start_nodes() for i in range(1, self.num_nodes): connect_nodes(self.nodes[i], 0) diff --git a/test/functional/multiwallet.py b/test/functional/multiwallet.py index 9d79e0249140..e4d7bde6bc52 100755 --- a/test/functional/multiwallet.py +++ b/test/functional/multiwallet.py @@ -184,5 +184,9 @@ def run_test(self): # Fail to load if wallet file is a symlink assert_raises_rpc_error(-4, "Wallet file verification failed: Invalid -wallet path 'w8_symlink'", self.nodes[0].loadwallet, 'w8_symlink') + # Fail to load if a directory is specified that doesn't contain a wallet + os.mkdir(wallet_dir('empty_wallet_dir')) + assert_raises_rpc_error(-18, "Directory empty_wallet_dir does not contain a wallet.dat file", self.nodes[0].loadwallet, 'empty_wallet_dir') + if __name__ == '__main__': MultiWalletTest().main() diff --git a/test/functional/node_network_limited.py b/test/functional/node_network_limited.py index 89669b0c0deb..58f45255bc76 100755 --- a/test/functional/node_network_limited.py +++ b/test/functional/node_network_limited.py @@ -13,6 +13,8 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, disconnect_nodes, connect_nodes_bi, sync_blocks +import sys + class P2PIgnoreInv(P2PInterface): firstAddrnServices = 0 def on_inv(self, message): @@ -32,6 +34,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 3 + self.stderr = sys.stdout self.extra_args = [['-prune=550', '-txindex=0', '-addrmantest'], [], []] def disconnect_all(self): diff --git a/test/functional/pruning.py b/test/functional/pruning.py index f5ac2023e486..8f7cfcaca863 100755 --- a/test/functional/pruning.py +++ b/test/functional/pruning.py @@ -37,10 +37,10 @@ def set_test_params(self): # Create nodes 5 to test wallet in prune mode, but do not connect self.extra_args = [self.full_node_default_args, self.full_node_default_args, - ["-litemode","-txindex=0","-maxreceivebuffer=20000","-prune=550"], - ["-litemode","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"], - ["-litemode","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"], - ["-litemode","-txindex=0","-prune=550"]] + ["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-prune=550"], + ["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"], + ["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"], + ["-disablegovernance","-txindex=0","-prune=550"]] def setup_network(self): self.setup_nodes() @@ -223,14 +223,14 @@ def reorg_back(self): def manual_test(self, node_number, use_timestamp): # at this point, node has 995 blocks and has not yet run in prune mode - self.start_node(node_number, extra_args=["-litemode", "-txindex=0"]) + self.start_node(node_number, extra_args=["-disablegovernance", "-txindex=0"]) node = self.nodes[node_number] assert_equal(node.getblockcount(), 995) assert_raises_rpc_error(-1, "not in prune mode", node.pruneblockchain, 500) # now re-start in manual pruning mode self.stop_node(node_number) - self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=1"]) + self.start_node(node_number, extra_args=["-disablegovernance", "-txindex=0", "-prune=1"]) node = self.nodes[node_number] assert_equal(node.getblockcount(), 995) @@ -312,7 +312,7 @@ def has_block(index): # stop node, start back up with auto-prune at 550MB, make sure still runs self.stop_node(node_number) - self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=550"]) + self.start_node(node_number, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"]) self.log.info("Success") @@ -320,7 +320,7 @@ def wallet_test(self): # check that the pruning node's wallet is still in good shape self.log.info("Stop and start pruning node to trigger wallet rescan") self.stop_node(2) - self.start_node(2, extra_args=["-litemode", "-txindex=0", "-prune=550"]) + self.start_node(2, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"]) self.log.info("Success") # check that wallet loads successfully when restarting a pruned node after IBD. @@ -330,7 +330,7 @@ def wallet_test(self): nds = [self.nodes[0], self.nodes[5]] self.sync_blocks(nds, wait=5, timeout=300) self.stop_node(5) #stop and start to trigger rescan - self.start_node(5, extra_args=["-litemode", "-txindex=0", "-prune=550"]) + self.start_node(5, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"]) self.log.info("Success") def run_test(self): diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index ae741d881c5a..f24a6aa32c74 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -156,7 +156,7 @@ EXTENDED_SCRIPTS = [ # These tests are not run by the travis build process. # Longest test should go first, to favor running tests in parallel - 'pruning.py', # NOTE: Prune mode is incompatible with -txindex, should work in litemode though. + 'pruning.py', # NOTE: Prune mode is incompatible with -txindex, should work governance validation disabled though. # vv Tests less than 20m vv 'smartfees.py', # vv Tests less than 5m vv