Skip to content

Commit edac100

Browse files
committed
Fix "quorum" RPCs help and unify logic in the sub-commands RPC entry point
1 parent 217f394 commit edac100

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

src/rpc/rpcquorums.cpp

+27-11
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
void quorum_list_help()
1414
{
1515
throw std::runtime_error(
16-
"quorum list (count)\n"
16+
"quorum list ( count )\n"
1717
"\nArguments:\n"
18-
"1. count (number, optional) Number of quorums to list.\n"
18+
"1. count (number, optional, default=10) Number of quorums to list.\n"
1919
);
2020
}
2121

@@ -51,11 +51,11 @@ UniValue quorum_list(const JSONRPCRequest& request)
5151
void quorum_info_help()
5252
{
5353
throw std::runtime_error(
54-
"quorum info \"llmqType\" \"blockquorumHash\" (includeSkShare)\n"
54+
"quorum info llmqType \"quorumHash\" ( includeSkShare )\n"
5555
"\nArguments:\n"
56-
"1. \"llmqType\" (int, required) LLMQ type.\n"
56+
"1. llmqType (int, required) LLMQ type.\n"
5757
"2. \"quorumHash\" (string, required) Block hash of quorum.\n"
58-
"3. \"includeSkShare\" (boolean, optional) Include secret key share in output.\n"
58+
"3. includeSkShare (boolean, optional) Include secret key share in output.\n"
5959
);
6060
}
6161

@@ -155,15 +155,31 @@ UniValue quorum_dkgstatus(const JSONRPCRequest& request)
155155
return status.ToJson(detailLevel);
156156
}
157157

158+
[[ noreturn ]] void quorum_help()
159+
{
160+
throw std::runtime_error(
161+
"quorum \"command\" ...\n"
162+
"Set of commands for quorums/LLMQs.\n"
163+
"To get help on individual commands, use \"help quorum command\".\n"
164+
"\nArguments:\n"
165+
"1. \"command\" (string, required) The command to execute\n"
166+
"\nAvailable commands:\n"
167+
" list - List of on-chain quorums\n"
168+
" info - Return information about a quorum\n"
169+
" dkgstatus - Return the status of the current DKG process\n"
170+
);
171+
}
172+
158173
UniValue quorum(const JSONRPCRequest& request)
159174
{
160-
if (request.params.empty()) {
161-
throw std::runtime_error(
162-
"quorum \"command\" ...\n"
163-
);
175+
if (request.fHelp && request.params.empty()) {
176+
quorum_help();
164177
}
165178

166-
std::string command = request.params[0].get_str();
179+
std::string command;
180+
if (request.params.size() >= 1) {
181+
command = request.params[0].get_str();
182+
}
167183

168184
if (command == "list") {
169185
return quorum_list(request);
@@ -172,7 +188,7 @@ UniValue quorum(const JSONRPCRequest& request)
172188
} else if (command == "dkgstatus") {
173189
return quorum_dkgstatus(request);
174190
} else {
175-
throw std::runtime_error("invalid command: " + command);
191+
quorum_help();
176192
}
177193
}
178194

0 commit comments

Comments
 (0)