7 #include <validation.h> 20 throw std::runtime_error(
21 "quorum list ( count )\n" 22 "List of on-chain quorums\n" 24 "1. count (number, optional) Number of quorums to list. Will list active quorums\n" 25 " if \"count\" is not specified.\n" 28 " \"quorumName\" : [ (array of strings) List of quorum hashes per some quorum type.\n" 29 " \"quorumHash\" (string) Quorum hash. Note: most recent quorums come first.\n" 57 for (
auto& p :
Params().GetConsensus().llmqs) {
61 for (
auto& q : quorums) {
74 throw std::runtime_error(
75 "quorum info llmqType \"quorumHash\" ( includeSkShare )\n" 76 "Return information about a quorum\n" 78 "1. llmqType (int, required) LLMQ type.\n" 79 "2. \"quorumHash\" (string, required) Block hash of quorum.\n" 80 "3. includeSkShare (boolean, optional) Include secret key share in output.\n" 95 for (
size_t i = 0; i <
quorum->members.
size(); i++) {
96 auto& dmn =
quorum->members[i];
99 mo.
push_back(
Pair(
"pubKeyOperator", dmn->pdmnState->pubKeyOperator.Get().ToString()));
101 if (
quorum->qc.validMembers[i]) {
114 if (includeSkShare && skShare.
IsValid()) {
135 bool includeSkShare =
false;
150 throw std::runtime_error(
151 "quorum dkgstatus ( detail_level )\n" 152 "Return the status of the current DKG process.\n" 153 "Works only when SPORK_17_QUORUM_DKG_ENABLED spork is ON.\n" 155 "1. detail_level (number, optional, default=0) Detail level of output.\n" 156 " 0=Only show counts. 1=Show member indexes. 2=Show member's ProTxHashes.\n" 169 if (detailLevel < 0 || detailLevel > 2) {
177 auto ret = status.
ToJson(detailLevel);
184 for (
const auto& p :
Params().GetConsensus().llmqs) {
185 auto& params = p.second;
191 std::map<uint256, CAddress> foundConnections;
198 for (
auto& ec : allConnections) {
201 if (foundConnections.count(ec)) {
203 obj.
push_back(
Pair(
"address", foundConnections[ec].ToString(
false)));
207 obj.
push_back(
Pair(
"outbound", outboundConnections.count(ec) != 0));
221 ret.push_back(
Pair(
"minableCommitments", minableCommitments));
222 ret.push_back(
Pair(
"quorumConnections", quorumConnections));
229 throw std::runtime_error(
230 "quorum memberof \"proTxHash\" (quorumCount)\n" 231 "Checks which quorums the given masternode is a member of.\n" 233 "1. \"proTxHash\" (string, required) ProTxHash of the masternode.\n" 234 "2. scanQuorumsCount (number, optional) Number of quorums to scan for. If not specified,\n" 235 " the active quorum count for each specific quorum type is used." 246 int scanQuorumsCount = -1;
249 if (scanQuorumsCount <= 0) {
261 auto dmn = mnList.GetMN(protxHash);
268 for (
const auto& p :
Params().GetConsensus().llmqs) {
269 auto& params = p.second;
270 size_t count = params.signingActiveQuorumCount;
271 if (scanQuorumsCount != -1) {
275 for (
auto&
quorum : quorums) {
276 if (
quorum->IsMember(dmn->proTxHash)) {
278 json.push_back(
Pair(
"isValidMember",
quorum->IsValidMember(dmn->proTxHash)));
279 json.push_back(
Pair(
"memberIndex",
quorum->GetMemberIndex(dmn->proTxHash)));
290 throw std::runtime_error(
291 "quorum sign llmqType \"id\" \"msgHash\" ( \"quorumHash\" )\n" 292 "Threshold-sign a message\n" 294 "1. llmqType (int, required) LLMQ type.\n" 295 "2. \"id\" (string, required) Request id.\n" 296 "3. \"msgHash\" (string, required) Message hash.\n" 297 "4. \"quorumHash\" (string, optional) The quorum identifier.\n" 303 throw std::runtime_error(
304 "quorum hasrecsig llmqType \"id\" \"msgHash\"\n" 305 "Test if a valid recovered signature is present\n" 307 "1. llmqType (int, required) LLMQ type.\n" 308 "2. \"id\" (string, required) Request id.\n" 309 "3. \"msgHash\" (string, required) Message hash.\n" 315 throw std::runtime_error(
316 "quorum getrecsig llmqType \"id\" \"msgHash\"\n" 317 "Get a recovered signature\n" 319 "1. llmqType (int, required) LLMQ type.\n" 320 "2. \"id\" (string, required) Request id.\n" 321 "3. \"msgHash\" (string, required) Message hash.\n" 327 throw std::runtime_error(
328 "quorum isconflicting llmqType \"id\" \"msgHash\"\n" 329 "Test if a conflict exists\n" 331 "1. llmqType (int, required) LLMQ type.\n" 332 "2. \"id\" (string, required) Request id.\n" 333 "3. \"msgHash\" (string, required) Message hash.\n" 345 }
else if (cmd ==
"hasrecsig") {
347 }
else if (cmd ==
"getrecsig") {
349 }
else if (cmd ==
"isconflicting") {
377 }
else if (cmd ==
"hasrecsig") {
379 }
else if (cmd ==
"getrecsig") {
384 if (recSig.
msgHash != msgHash) {
388 }
else if (cmd ==
"isconflicting") {
398 throw std::runtime_error(
399 "quorum selectquorum llmqType \"id\"\n" 400 "Returns the quorum that would/should sign a request\n" 402 "1. llmqType (int, required) LLMQ type.\n" 403 "2. \"id\" (string, required) Request id.\n" 429 for (
int i = 0; i <
quorum->params.recoveryMembers; i++) {
431 recoveryMembers.
push_back(dmn->proTxHash.ToString());
440 throw std::runtime_error(
441 "quorum dkgsimerror \"type\" rate\n" 442 "This enables simulation of errors and malicious behaviour in the DKG. Do NOT use this on mainnet\n" 443 "as you will get yourself very likely PoSe banned for this.\n" 445 "1. \"type\" (string, required) Error type.\n" 446 "2. rate (number, required) Rate at which to simulate this error type.\n" 460 if (rate < 0 || rate > 1) {
472 throw std::runtime_error(
473 "quorum \"command\" ...\n" 474 "Set of commands for quorums/LLMQs.\n" 475 "To get help on individual commands, use \"help quorum command\".\n" 477 "1. \"command\" (string, required) The command to execute\n" 478 "\nAvailable commands:\n" 479 " list - List of on-chain quorums\n" 480 " info - Return information about a quorum\n" 481 " dkgsimerror - Simulates DKG errors and malicious behavior\n" 482 " dkgstatus - Return the status of the current DKG process\n" 483 " memberof - Checks which quorums the given masternode is a member of\n" 484 " sign - Threshold-sign a message\n" 485 " hasrecsig - Test if a valid recovered signature is present\n" 486 " getrecsig - Get a recovered signature\n" 487 " isconflicting - Test if a conflict exists\n" 488 " selectquorum - Return the quorum that would/should sign a request\n" 503 if (command ==
"list") {
505 }
else if (command ==
"info") {
507 }
else if (command ==
"dkgstatus") {
509 }
else if (command ==
"memberof") {
511 }
else if (command ==
"sign" || command ==
"hasrecsig" || command ==
"getrecsig" || command ==
"isconflicting") {
513 }
else if (command ==
"selectquorum") {
515 }
else if (command ==
"dkgsimerror") {
525 {
"evo",
"quorum", &
quorum, {} },
void SetSimulatedDKGErrorRate(const std::string &type, double rate)
static std::set< uint256 > GetQuorumConnections(Consensus::LLMQType llmqType, const CBlockIndex *pindexQuorum, const uint256 &forMember, bool onlyOutbound)
CSigSharesManager * quorumSigSharesManager
UniValue quorum(const JSONRPCRequest &request)
double ParseDoubleV(const UniValue &v, const std::string &strName)
UniValue BuildQuorumInfo(const llmq::CQuorumCPtr &quorum, bool includeMembers, bool includeSkShare)
UniValue ToJson(int detailLevel) const
Dash RPC command dispatcher.
UniValue quorum_selectquorum(const JSONRPCRequest &request)
void quorum_selectquorum_help()
void quorum_getrecsig_help()
int32_t ParseInt32V(const UniValue &v, const std::string &strName)
CQuorumBlockProcessor * quorumBlockProcessor
int Height() const
Return the maximal height in the chain.
void quorum_memberof_help()
void RegisterQuorumsRPCCommands(CRPCTable &tableRPC)
Register Quorums RPC commands.
const std::string & get_str() const
std::vector< CQuorumCPtr > ScanQuorums(Consensus::LLMQType llmqType, size_t maxCount)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
bool AsyncSignIfMember(Consensus::LLMQType llmqType, const uint256 &id, const uint256 &msgHash, bool allowReSign=false)
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
UniValue quorum_sigs_cmd(const JSONRPCRequest &request)
static const CRPCCommand commands[]
Invalid, missing or duplicate parameter.
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
CQuorumManager * quorumManager
bool HasRecoveredSig(Consensus::LLMQType llmqType, const uint256 &id, const uint256 &msgHash)
static CDeterministicMNCPtr SelectMemberForRecovery(const CQuorumCPtr &quorum, const uint256 &id, int attempt)
void quorum_dkgsimerror_help()
bool push_back(const UniValue &val)
void quorum_isconflicting_help()
CActiveMasternodeInfo activeMasternodeInfo
std::string ToString() const
CQuorumCPtr SelectQuorumForSigning(Consensus::LLMQType llmqType, const uint256 &selectionHash, int signHeight=-1, int signOffset=SIGN_HEIGHT_OFFSET)
UniValue quorum_dkgsimerror(const JSONRPCRequest &request)
void GetLocalDebugStatus(CDKGDebugStatus &ret)
void quorum_dkgstatus_help()
General application defined errors.
CDKGDebugManager * quorumDKGDebugManager
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)
UniValue quorum_list(const JSONRPCRequest &request)
UniValue quorum_info(const JSONRPCRequest &request)
std::map< LLMQType, LLMQParams > llmqs
void quorum_hasrecsig_help()
uint256 verifiedProRegTxHash
void AsyncSign(const CQuorumCPtr &quorum, const uint256 &id, const uint256 &msgHash)
bool IsConflicting(Consensus::LLMQType llmqType, const uint256 &id, const uint256 &msgHash)
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
UniValue quorum_dkgstatus(const JSONRPCRequest &request)
UniValue quorum_memberof(const JSONRPCRequest &request)
std::shared_ptr< const CQuorum > CQuorumCPtr
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
std::unique_ptr< CConnman > g_connman
bool ParseBoolV(const UniValue &v, const std::string &strName)
CQuorumCPtr GetQuorum(Consensus::LLMQType llmqType, const uint256 &quorumHash)
CSigningManager * quorumSigningManager
UniValue JSONRPCError(int code, const std::string &message)
Information about a peer.
const Consensus::Params & GetConsensus() const
void ToJson(UniValue &obj) const
CChain & chainActive
The currently-connected chain of blocks (protected by cs_main).