aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorselsta <selsta@sent.at>2026-03-25 20:37:18 +0100
committerselsta <selsta@sent.at>2026-04-01 18:06:10 +0200
commit7f2cfe9294ec1fa7bece2a8069114c1b6985650f (patch)
tree06a5d19a645f700b02b9bdcacaff915c7bd9974a /tests/unit_tests
parentdd0fb6c7552330a088033b0cfba0ba570bbbfd15 (diff)
downloadmonzero-core-7f2cfe9294ec1fa7bece2a8069114c1b6985650f.tar.gz
monzero-core-7f2cfe9294ec1fa7bece2a8069114c1b6985650f.tar.xz
monzero-core-7f2cfe9294ec1fa7bece2a8069114c1b6985650f.zip
zmq: add restricted rpc mode
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/zmq_rpc.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit_tests/zmq_rpc.cpp b/tests/unit_tests/zmq_rpc.cpp
index c98f0011b..38b5f083f 100644
--- a/tests/unit_tests/zmq_rpc.cpp
+++ b/tests/unit_tests/zmq_rpc.cpp
@@ -39,6 +39,7 @@
#include "net/zmq.h"
#include "rpc/message.h"
#include "rpc/zmq_pub.h"
+#include "rpc/zmq_restricted_methods.h"
#include "rpc/zmq_server.h"
#include "serialization/json_object.h"
@@ -69,6 +70,23 @@ TEST(ZmqFullMessage, Request)
EXPECT_STREQ("foo", parsed.getRequestType().c_str());
}
+TEST(ZmqRestrictedMethods, BasicCoverage)
+{
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("flush_txpool"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("get_peer_list"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("mining_status"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("relay_tx"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("save_bc"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("set_log_categories"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("set_log_level"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("start_mining"));
+ EXPECT_TRUE(cryptonote::rpc::is_blocked_in_restricted_mode("stop_mining"));
+
+ EXPECT_FALSE(cryptonote::rpc::is_blocked_in_restricted_mode("get_height"));
+ EXPECT_FALSE(cryptonote::rpc::is_blocked_in_restricted_mode("get_info"));
+ EXPECT_FALSE(cryptonote::rpc::is_blocked_in_restricted_mode("send_raw_tx"));
+}
+
namespace
{
using published_json = std::pair<std::string, rapidjson::Document>;