From 50b09b88e40299f81e25aaa5a1614ad4f7140426 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 17 Jul 2020 02:30:00 +0300 Subject: [PATCH] Add `CPrivateSendClientOptions::GetJsonInfo()` --- src/privatesend/privatesend-client.cpp | 12 ++++++++++++ src/privatesend/privatesend-client.h | 2 ++ src/rpc/privatesend.cpp | 11 +++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/privatesend/privatesend-client.cpp b/src/privatesend/privatesend-client.cpp index 9ff9ce9c7d..1cb8020f70 100644 --- a/src/privatesend/privatesend-client.cpp +++ b/src/privatesend/privatesend-client.cpp @@ -1843,6 +1843,18 @@ void CPrivateSendClientManager::GetJsonInfo(UniValue& obj) const obj.pushKV("sessions", arrSessions); } +void CPrivateSendClientOptions::GetJsonInfo(UniValue& obj) const +{ + assert(obj.isObject()); + obj.pushKV("enabled", privateSendClientOptions.fEnablePrivateSend); + obj.pushKV("multisession", privateSendClientOptions.fPrivateSendMultiSession); + obj.pushKV("max_sessions", privateSendClientOptions.nPrivateSendSessions); + obj.pushKV("max_rounds", privateSendClientOptions.nPrivateSendRounds); + obj.pushKV("max_amount", privateSendClientOptions.nPrivateSendAmount); + obj.pushKV("denoms_goal", privateSendClientOptions.nPrivateSendDenomsGoal); + obj.pushKV("denoms_hardcap", privateSendClientOptions.nPrivateSendDenomsHardCap); +} + void DoPrivateSendMaintenance(CConnman& connman) { privateSendClientQueueManager.DoMaintenance(); diff --git a/src/privatesend/privatesend-client.h b/src/privatesend/privatesend-client.h index 0db1527e8f..e716c9df58 100644 --- a/src/privatesend/privatesend-client.h +++ b/src/privatesend/privatesend-client.h @@ -298,6 +298,8 @@ public: fPrivateSendMultiSession(DEFAULT_PRIVATESEND_MULTISESSION) { } + + void GetJsonInfo(UniValue& obj) const; }; void DoPrivateSendMaintenance(CConnman& connman); diff --git a/src/rpc/privatesend.cpp b/src/rpc/privatesend.cpp index 78777c90d9..085cced822 100644 --- a/src/rpc/privatesend.cpp +++ b/src/rpc/privatesend.cpp @@ -136,14 +136,9 @@ UniValue getprivatesendinfo(const JSONRPCRequest& request) #ifdef ENABLE_WALLET - obj.pushKV("enabled", privateSendClientOptions.fEnablePrivateSend); - obj.pushKV("multisession", privateSendClientOptions.fPrivateSendMultiSession); - obj.pushKV("max_sessions", privateSendClientOptions.nPrivateSendSessions); - obj.pushKV("max_rounds", privateSendClientOptions.nPrivateSendRounds); - obj.pushKV("max_amount", privateSendClientOptions.nPrivateSendAmount); - obj.pushKV("denoms_goal", privateSendClientOptions.nPrivateSendDenomsGoal); - obj.pushKV("denoms_hardcap", privateSendClientOptions.nPrivateSendDenomsHardCap); - obj.pushKV("queue_size", privateSendClientQueueManager.GetQueueSize()); + privateSendClientOptions.GetJsonInfo(obj); + + obj.pushKV("queue_size", privateSendClientQueueManager.GetQueueSize()); CWallet* const pwallet = GetWalletForJSONRPCRequest(request); if (!pwallet) {