Skip to content

Commit 50c99e8

Browse files
committed
fix: adopt platform restriction for new composite commands
1 parent e3c4d66 commit 50c99e8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/rpc/server.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ void CRPCTable::InitPlatformRestrictions()
153153
{"getblockhash", {}},
154154
{"getblockcount", {}},
155155
{"getbestchainlock", {}},
156-
{"quorum", {"sign", static_cast<uint8_t>(Params().GetConsensus().llmqTypePlatform)}},
157-
{"quorum", {"verify"}},
156+
{"quorum sign", {static_cast<uint8_t>(Params().GetConsensus().llmqTypePlatform)}},
157+
{"quorum verify", {}},
158158
{"submitchainlock", {}},
159159
{"verifyislock", {}},
160160
};
@@ -535,7 +535,9 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
535535
// Before executing the RPC Command, filter commands from platform rpc user
536536
if (node.mn_activeman && request.authUser == gArgs.GetArg("-platform-user", defaultPlatformUser)) {
537537
// replace this with structured binding in c++20
538-
const auto& it = mapPlatformRestrictions.equal_range(request.strMethod);
538+
std::string command_name = command.name;
539+
if (!command.subname.empty()) command_name += " " + command.subname;
540+
const auto& it = mapPlatformRestrictions.equal_range(command_name);
539541
const auto& allowed_begin = it.first;
540542
const auto& allowed_end = it.second;
541543
/**
@@ -545,8 +547,8 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
545547
*
546548
* if request.strMethod == "quorum":
547549
* [
548-
* "quorum", ["sign", platformLlmqType],
549-
* "quorum", ["verify"]
550+
* "quorum sign", [platformLlmqType],
551+
* "quorum verify", []
550552
* ]
551553
* if request.strMethod == "verifyislock"
552554
* [

0 commit comments

Comments
 (0)