aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2024-06-24 13:16:20 -0700
committerj-berman <justinberman@protonmail.com>2024-06-24 17:44:23 -0700
commit6c28bdb8563b352d8a58e3104d9796006e27a44d (patch)
tree9740580ec391f09e62ef92b11fbc0094d0b14723 /src/rpc
parentMerge pull request #9202 (diff)
downloadmonero-6c28bdb8563b352d8a58e3104d9796006e27a44d.tar.xz
wallet2: move get_rpc_status func to RPC server definition file
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index c634b8957..def1f3804 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -80,6 +80,19 @@ namespace cryptonote
#define CORE_RPC_STATUS_NOT_MINING "NOT MINING"
#define CORE_RPC_STATUS_PAYMENT_REQUIRED "PAYMENT REQUIRED"
+inline const std::string get_rpc_status(const bool trusted_daemon, const std::string &s)
+{
+ if (trusted_daemon)
+ return s;
+ if (s == CORE_RPC_STATUS_OK)
+ return s;
+ if (s == CORE_RPC_STATUS_BUSY)
+ return s;
+ if (s == CORE_RPC_STATUS_PAYMENT_REQUIRED)
+ return s;
+ return "<error>";
+}
+
// When making *any* change here, bump minor
// If the change is incompatible, then bump major and set minor to 0
// This ensures CORE_RPC_VERSION always increases, that every change