mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
d371930
Added nMinGivernanceQuorum chain parameter6e24c9c
Replace hardcoded minimum with nMinGovernanceQuorum parameter66c0d9e
Added new RPC calls needed by Sentinel - getsuperblockcycle - getsuperblockbudget - getmingovernancequorum6bb2338
Replaced two new RPC calls with getgovernanceinfoc9fbd8a
Changed parameter nMinGovernanceQuorum to nGovernanceMinQuorum
This commit is contained in:
parent
7b10f9aaa6
commit
0c65204ee6
@ -84,6 +84,7 @@ public:
|
|||||||
consensus.nBudgetProposalEstablishingTime = 60*60*24;
|
consensus.nBudgetProposalEstablishingTime = 60*60*24;
|
||||||
consensus.nSuperblockStartBlock = 543210; // TODO, the block at which 12.1 goes live.
|
consensus.nSuperblockStartBlock = 543210; // TODO, the block at which 12.1 goes live.
|
||||||
consensus.nSuperblockCycle = 576; // Superblocks can be issued daily
|
consensus.nSuperblockCycle = 576; // Superblocks can be issued daily
|
||||||
|
consensus.nGovernanceMinQuorum = 10;
|
||||||
consensus.nMasternodeMinimumConfirmations = 15;
|
consensus.nMasternodeMinimumConfirmations = 15;
|
||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
consensus.nMajorityRejectBlockOutdated = 950;
|
consensus.nMajorityRejectBlockOutdated = 950;
|
||||||
@ -205,6 +206,7 @@ public:
|
|||||||
consensus.nBudgetProposalEstablishingTime = 60*20;
|
consensus.nBudgetProposalEstablishingTime = 60*20;
|
||||||
consensus.nSuperblockStartBlock = 54321; // TODO, the block at which 12.1 goes live.
|
consensus.nSuperblockStartBlock = 54321; // TODO, the block at which 12.1 goes live.
|
||||||
consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
|
consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
|
||||||
|
consensus.nGovernanceMinQuorum = 1;
|
||||||
consensus.nMasternodeMinimumConfirmations = 1;
|
consensus.nMasternodeMinimumConfirmations = 1;
|
||||||
consensus.nMajorityEnforceBlockUpgrade = 51;
|
consensus.nMajorityEnforceBlockUpgrade = 51;
|
||||||
consensus.nMajorityRejectBlockOutdated = 75;
|
consensus.nMajorityRejectBlockOutdated = 75;
|
||||||
@ -306,6 +308,7 @@ public:
|
|||||||
consensus.nBudgetProposalEstablishingTime = 60*20;
|
consensus.nBudgetProposalEstablishingTime = 60*20;
|
||||||
consensus.nSuperblockStartBlock = 1500;
|
consensus.nSuperblockStartBlock = 1500;
|
||||||
consensus.nSuperblockCycle = 10;
|
consensus.nSuperblockCycle = 10;
|
||||||
|
consensus.nGovernanceMinQuorum = 1;
|
||||||
consensus.nMasternodeMinimumConfirmations = 1;
|
consensus.nMasternodeMinimumConfirmations = 1;
|
||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
consensus.nMajorityRejectBlockOutdated = 950;
|
consensus.nMajorityRejectBlockOutdated = 950;
|
||||||
|
@ -48,6 +48,7 @@ struct Params {
|
|||||||
int nBudgetProposalEstablishingTime; // in seconds
|
int nBudgetProposalEstablishingTime; // in seconds
|
||||||
int nSuperblockStartBlock;
|
int nSuperblockStartBlock;
|
||||||
int nSuperblockCycle; // in blocks
|
int nSuperblockCycle; // in blocks
|
||||||
|
int nGovernanceMinQuorum; // Min absolute vote count to trigger an action
|
||||||
int nMasternodeMinimumConfirmations;
|
int nMasternodeMinimumConfirmations;
|
||||||
/** Used to check majorities for block version upgrade */
|
/** Used to check majorities for block version upgrade */
|
||||||
int nMajorityEnforceBlockUpgrade;
|
int nMajorityEnforceBlockUpgrade;
|
||||||
|
@ -1104,7 +1104,7 @@ void CGovernanceObject::UpdateSentinelVariables(const CBlockIndex *pCurrentBlock
|
|||||||
// CALCULATE THE MINUMUM VOTE COUNT REQUIRED FOR FULL SIGNAL
|
// CALCULATE THE MINUMUM VOTE COUNT REQUIRED FOR FULL SIGNAL
|
||||||
|
|
||||||
// todo - 12.1 - should be set to `10` after governance vote compression is implemented
|
// todo - 12.1 - should be set to `10` after governance vote compression is implemented
|
||||||
int nAbsVoteReq = max(1, nMnCount / 10);
|
int nAbsVoteReq = max(Params().GetConsensus().nGovernanceMinQuorum, nMnCount / 10);
|
||||||
// todo - 12.1 - Temporarily set to 1 for testing - reverted
|
// todo - 12.1 - Temporarily set to 1 for testing - reverted
|
||||||
//nAbsVoteReq = 1;
|
//nAbsVoteReq = 1;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
|||||||
{ "getchaintips", 0 },
|
{ "getchaintips", 0 },
|
||||||
{ "getchaintips", 1 },
|
{ "getchaintips", 1 },
|
||||||
{ "getblockhash", 0 },
|
{ "getblockhash", 0 },
|
||||||
|
{ "getsuperblockbudget", 0 },
|
||||||
{ "move", 2 },
|
{ "move", 2 },
|
||||||
{ "move", 3 },
|
{ "move", 3 },
|
||||||
{ "sendfrom", 2 },
|
{ "sendfrom", 2 },
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "rpcserver.h"
|
#include "rpcserver.h"
|
||||||
#include "utilmoneystr.h"
|
#include "utilmoneystr.h"
|
||||||
#include "governance-vote.h"
|
#include "governance-vote.h"
|
||||||
|
#include "governance-classes.h"
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -602,3 +603,54 @@ UniValue voteraw(const UniValue& params, bool fHelp)
|
|||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Error voting : " + strError);
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Error voting : " + strError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue getgovernanceinfo(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
if (fHelp || params.size() != 0) {
|
||||||
|
throw runtime_error(
|
||||||
|
"getgovernanceinfo\n"
|
||||||
|
"Returns an object containing governance parameters.\n"
|
||||||
|
"\nResult:\n"
|
||||||
|
"{\n"
|
||||||
|
" \"governanceminquorum\": xxxxx, (numeric) the absolute minimum number of votes needed to trigger a governance action\n"
|
||||||
|
" \"superblockcycle\": xxxxx, (numeric) the number of blocks between superblocks\n"
|
||||||
|
"}\n"
|
||||||
|
"\nExamples:\n"
|
||||||
|
+ HelpExampleCli("getgovernanceinfo", "")
|
||||||
|
+ HelpExampleRpc("getgovernanceinfo", "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
obj.push_back(Pair("governanceminquorum", Params().GetConsensus().nGovernanceMinQuorum));
|
||||||
|
obj.push_back(Pair("superblockcycle", Params().GetConsensus().nSuperblockCycle));
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
UniValue getsuperblockbudget(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
if (fHelp || params.size() != 1) {
|
||||||
|
throw runtime_error(
|
||||||
|
"getsuperblockbudget index\n"
|
||||||
|
"\nReturns the absolute minimum number of votes needed to trigger a governance action.\n"
|
||||||
|
"\nArguments:\n"
|
||||||
|
"1. index (numeric, required) The block index\n"
|
||||||
|
"\nResult:\n"
|
||||||
|
"n (numeric) The current minimum governance quorum\n"
|
||||||
|
"\nExamples:\n"
|
||||||
|
+ HelpExampleCli("getsuperblockbudget", "1000")
|
||||||
|
+ HelpExampleRpc("getsuperblockbudget", "1000")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nBlockHeight = params[0].get_int();
|
||||||
|
if (nBlockHeight < 0) {
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
|
||||||
|
}
|
||||||
|
|
||||||
|
CAmount nBudget = CSuperblock::GetPaymentsLimit(nBlockHeight);
|
||||||
|
std::string strBudget = FormatMoney(nBudget);
|
||||||
|
|
||||||
|
return strBudget;
|
||||||
|
}
|
||||||
|
@ -347,6 +347,8 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
{ "dash", "masternodelist", &masternodelist, true },
|
{ "dash", "masternodelist", &masternodelist, true },
|
||||||
{ "dash", "masternodebroadcast", &masternodebroadcast, true },
|
{ "dash", "masternodebroadcast", &masternodebroadcast, true },
|
||||||
{ "dash", "gobject", &gobject, true },
|
{ "dash", "gobject", &gobject, true },
|
||||||
|
{ "dash", "getgovernanceinfo", &getgovernanceinfo, true },
|
||||||
|
{ "dash", "getsuperblockbudget", &getsuperblockbudget, true },
|
||||||
{ "dash", "voteraw", &voteraw, true },
|
{ "dash", "voteraw", &voteraw, true },
|
||||||
{ "dash", "mnsync", &mnsync, true },
|
{ "dash", "mnsync", &mnsync, true },
|
||||||
{ "dash", "spork", &spork, true },
|
{ "dash", "spork", &spork, true },
|
||||||
|
@ -271,6 +271,8 @@ extern UniValue masternode(const UniValue& params, bool fHelp);
|
|||||||
extern UniValue masternodelist(const UniValue& params, bool fHelp);
|
extern UniValue masternodelist(const UniValue& params, bool fHelp);
|
||||||
extern UniValue masternodebroadcast(const UniValue& params, bool fHelp);
|
extern UniValue masternodebroadcast(const UniValue& params, bool fHelp);
|
||||||
extern UniValue gobject(const UniValue& params, bool fHelp);
|
extern UniValue gobject(const UniValue& params, bool fHelp);
|
||||||
|
extern UniValue getgovernanceinfo(const UniValue& params, bool fHelp);
|
||||||
|
extern UniValue getsuperblockbudget(const UniValue& params, bool fHelp);
|
||||||
extern UniValue voteraw(const UniValue& params, bool fHelp);
|
extern UniValue voteraw(const UniValue& params, bool fHelp);
|
||||||
extern UniValue mnsync(const UniValue& params, bool fHelp);
|
extern UniValue mnsync(const UniValue& params, bool fHelp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user