Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use new type of composite commands for quorum NNN #6055

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: adopt platform restriction for new composite commands
  • Loading branch information
knst committed Jun 11, 2024
commit 50c99e84f84e1a6101537b12f71b485edb4c6a1c
12 changes: 7 additions & 5 deletions src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ void CRPCTable::InitPlatformRestrictions()
{"getblockhash", {}},
{"getblockcount", {}},
{"getbestchainlock", {}},
{"quorum", {"sign", static_cast<uint8_t>(Params().GetConsensus().llmqTypePlatform)}},
{"quorum", {"verify"}},
{"quorum sign", {static_cast<uint8_t>(Params().GetConsensus().llmqTypePlatform)}},
{"quorum verify", {}},
{"submitchainlock", {}},
{"verifyislock", {}},
};
Expand Down Expand Up @@ -535,7 +535,9 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
// Before executing the RPC Command, filter commands from platform rpc user
if (node.mn_activeman && request.authUser == gArgs.GetArg("-platform-user", defaultPlatformUser)) {
// replace this with structured binding in c++20
const auto& it = mapPlatformRestrictions.equal_range(request.strMethod);
std::string command_name = command.name;
if (!command.subname.empty()) command_name += " " + command.subname;
const auto& it = mapPlatformRestrictions.equal_range(command_name);
const auto& allowed_begin = it.first;
const auto& allowed_end = it.second;
/**
Expand All @@ -545,8 +547,8 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
*
* if request.strMethod == "quorum":
* [
* "quorum", ["sign", platformLlmqType],
* "quorum", ["verify"]
* "quorum sign", [platformLlmqType],
* "quorum verify", []
* ]
* if request.strMethod == "verifyislock"
* [
Expand Down