Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions src/rpc/rpcquorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,42 +649,40 @@ static UniValue quorum_getdata(const JSONRPCRequest& request)
});
}

static void quorum_getrotationinfo_help()
static void quorum_rotationinfo_help()
{
throw std::runtime_error(
RPCHelpMan{
"quorum rotationinfo",
"Get quorum rotation information\n",
{{"blockRequestHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The blockHash of the request."},
{"baseBlockHashesNb", RPCArg::Type::NUM, RPCArg::Optional::NO,
"Number of baseBlockHashes"},
{"extraShare", RPCArg::Type::BOOL, RPCArg::Optional::NO, "Extra share"}},
{
{"blockRequestHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The blockHash of the request"},
{"extraShare", RPCArg::Type::BOOL, /* default */ "false", "Extra share"},
{"baseBlockHash...", RPCArg::Type::STR_HEX, /* default*/ "", "baseBlockHashes"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this argument name truncated?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... just indicates that there are many of them. We could probably turn it into a json array instead if that would make it clearer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's just multiple strings separated by spaces? Is there a limit to how many can be put there?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's multiple hashes. There is no limit atm (there was none in the code I refactored so I kept it). I'm not sure if we have to put one in place though.. Thoughts @ogabrielides @PastaPastaPasta ?

},
RPCResults{},
RPCExamples{""},
}
.ToString());
.ToString());
}

static UniValue quorum_getrotationdata(const JSONRPCRequest& request)
static UniValue quorum_rotationinfo(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() < 2)) {
quorum_getrotationinfo_help();
quorum_rotationinfo_help();
}

llmq::CGetQuorumRotationInfo cmd;
llmq::CQuorumRotationInfo quorumRotationInfoRet;
std::string strError;

cmd.blockRequestHash = ParseHashV(request.params[1], "blockRequestHash");
size_t baseBlockHashesNb = static_cast<uint32_t>(ParseInt32V(request.params[2], "baseBlockHashesNb"));
cmd.extraShare = ParseBoolV(request.params[3], "extraShare");

/*if (request.params.size() - 2 != cmd.baseBlockHashesNb) {
quorum_getrotationinfo_help();
}*/
cmd.extraShare = request.params[2].isNull() ? false : ParseBoolV(request.params[2], "extraShare");

for (auto i = 0; i < baseBlockHashesNb; i++) {
cmd.baseBlockHashes.push_back(ParseHashV(request.params[3 + i], "quorumHash"));
size_t idx = 3;
while (!request.params[idx].isNull()) {
cmd.baseBlockHashes.emplace_back(ParseHashV(request.params[idx], "baseBlockHash"));
++idx;
}
LOCK(cs_main);
if (!BuildQuorumRotationInfo(cmd, quorumRotationInfoRet, strError)) {
Expand Down Expand Up @@ -755,7 +753,7 @@ static UniValue _quorum(const JSONRPCRequest& request)
} else if (command == "getdata") {
return quorum_getdata(request);
} else if (command == "rotationinfo") {
return quorum_getrotationdata(request);
return quorum_rotationinfo(request);
} else {
quorum_help();
}
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ def mine_cycle_quorum(self, llmq_type_name="llmq_test_dip0024", llmq_type=103,

best_block_hash = self.nodes[0].getbestblockhash()
block_height = self.nodes[0].getblockcount()
quorum_rotation_info = self.nodes[0].quorum("rotationinfo", best_block_hash, 0, False)
quorum_rotation_info = self.nodes[0].quorum("rotationinfo", best_block_hash)
self.log.info("h("+str(block_height)+"):"+str(quorum_rotation_info))

return (quorum_info_0, quorum_info_1)
Expand Down