mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Change litemode to disablegovernance (#3577)
* Change litemode to disablegovernance, this makes it more clear what that flag actually does. Signed-off-by: pasta <pasta@dashboost.org> * more fLiteMode to fDisableGovernance Signed-off-by: pasta <pasta@dashboost.org> * handle -litemode being set Signed-off-by: pasta <pasta@dashboost.org>
This commit is contained in:
parent
9298a80a2c
commit
b463e5780e
@ -71,7 +71,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
|
||||
llmq::quorumManager->UpdatedBlockTip(pindexNew, fInitialDownload);
|
||||
llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, fInitialDownload);
|
||||
|
||||
if (!fLiteMode) governance.UpdatedBlockTip(pindexNew, connman);
|
||||
if (!fDisableGovernance) governance.UpdatedBlockTip(pindexNew, connman);
|
||||
}
|
||||
|
||||
void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx, int64_t nAcceptTime)
|
||||
|
@ -87,8 +87,7 @@ bool CGovernanceManager::SerializeVoteForHash(const uint256& nHash, CDataStream&
|
||||
|
||||
void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman, bool enable_bip61)
|
||||
{
|
||||
// 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
|
||||
|
||||
|
32
src/init.cpp
32
src/init.cpp
@ -278,7 +278,7 @@ void PrepareShutdown()
|
||||
flatdb4.Dump(netfulfilledman);
|
||||
CFlatDB<CSporkManager> flatdb6("sporks.dat", "magicSporkCache");
|
||||
flatdb6.Dump(sporkManager);
|
||||
if (!fLiteMode) {
|
||||
if (!fDisableGovernance) {
|
||||
CFlatDB<CGovernanceManager> flatdb3("governance.dat", "magicGovernanceCache");
|
||||
flatdb3.Dump(governance);
|
||||
}
|
||||
@ -614,7 +614,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 governance validation (0-1, default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-disablegovernance", strprintf(_("Disable governance validation (0-1, default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-sporkaddr=<dashaddress>", strprintf(_("Override spork address. Only useful for regtest and devnet. Using this on mainnet or testnet will ban you.")));
|
||||
strUsage += HelpMessageOpt("-minsporkkeys=<n>", strprintf(_("Overrides minimum spork signers to change spork value. Only useful for regtest and devnet. Using this on mainnet or testnet will ban you.")));
|
||||
|
||||
@ -1196,6 +1196,14 @@ bool AppInitParameterInteraction()
|
||||
if (gArgs.IsArgSet("-blockminsize"))
|
||||
InitWarning("Unsupported argument -blockminsize ignored.");
|
||||
|
||||
if (gArgs.GetBoolArg("-litemode", false)) {
|
||||
InitWarning(_("Warning: -litemode is deprecated, please use -disablegovernance.\n"));
|
||||
if (gArgs.SoftSetBoolArg("-disablegovernance", true)) {
|
||||
LogPrintf("%s: parameter interaction: -litemode=true -> setting -disablegovernance=true\n", __func__);
|
||||
}
|
||||
gArgs.ForceRemoveArg("-litemode");
|
||||
}
|
||||
|
||||
// Checkmempool and checkblockindex default to true in regtest mode
|
||||
int ratio = std::min<int>(std::max<int>(gArgs.GetArg("-checkmempool", chainparams.DefaultConsistencyChecks() ? 1 : 0), 0), 1000000);
|
||||
if (ratio != 0) {
|
||||
@ -1502,8 +1510,8 @@ 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."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1779,11 +1787,11 @@ bool AppInitMain()
|
||||
// ********************************************************* Step 7a: check lite mode and load sporks
|
||||
|
||||
// lite mode disables governance validation
|
||||
fLiteMode = gArgs.GetBoolArg("-litemode", false);
|
||||
LogPrintf("fLiteMode %d\n", fLiteMode);
|
||||
fDisableGovernance = gArgs.GetBoolArg("-disablegovernance", false);
|
||||
LogPrintf("fDisableGovernance %d\n", fDisableGovernance);
|
||||
|
||||
if(fLiteMode) {
|
||||
InitWarning(_("You are starting in lite mode, governance validation is disabled."));
|
||||
if(fDisableGovernance) {
|
||||
InitWarning(_("You are starting with governance validation disabled."));
|
||||
}
|
||||
|
||||
uiInterface.InitMessage(_("Loading sporks cache..."));
|
||||
@ -1863,9 +1871,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
|
||||
@ -2131,7 +2139,7 @@ bool AppInitMain()
|
||||
strDBName = "governance.dat";
|
||||
uiInterface.InitMessage(_("Loading governance cache..."));
|
||||
CFlatDB<CGovernanceManager> flatdb3(strDBName, "magicGovernanceCache");
|
||||
if (fLoadCacheFiles && !fLiteMode) {
|
||||
if (fLoadCacheFiles && !fDisableGovernance) {
|
||||
if(!flatdb3.Load(governance)) {
|
||||
return InitError(_("Failed to load governance cache from") + "\n" + (pathDB / strDBName).string());
|
||||
}
|
||||
@ -2163,7 +2171,7 @@ bool AppInitMain()
|
||||
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 (!fLiteMode) {
|
||||
if (!fDisableGovernance) {
|
||||
scheduler.scheduleEvery(boost::bind(&CGovernanceManager::DoMaintenance, boost::ref(governance), boost::ref(*g_connman)), 60 * 5 * 1000);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -230,7 +230,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
|
||||
// GOVOBJ : SYNC GOVERNANCE ITEMS FROM OUR PEERS
|
||||
|
||||
if(nCurrentAsset == MASTERNODE_SYNC_GOVERNANCE) {
|
||||
if (fLiteMode) {
|
||||
if (fDisableGovernance) {
|
||||
SwitchToNextAsset(connman);
|
||||
connman.ReleaseNodeVector(vNodesCopy);
|
||||
return;
|
||||
|
@ -1134,7 +1134,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
|
||||
tooltip += QString("<br>");
|
||||
tooltip += tr("Transactions after this will not yet be visible.");
|
||||
} else if (fLiteMode) {
|
||||
} else if (fDisableGovernance) {
|
||||
setAdditionalDataSyncProgress(1);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,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
|
||||
|
@ -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)
|
||||
|
@ -37,10 +37,10 @@ class PruneTest(BitcoinTestFramework):
|
||||
# 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 @@ class PruneTest(BitcoinTestFramework):
|
||||
|
||||
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 @@ class PruneTest(BitcoinTestFramework):
|
||||
|
||||
# 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 @@ class PruneTest(BitcoinTestFramework):
|
||||
# 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 @@ class PruneTest(BitcoinTestFramework):
|
||||
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):
|
||||
|
@ -160,7 +160,7 @@ BASE_SCRIPTS= [
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user