From 582daf6d22da5394d02a12003b9542d9f5865ae2 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Mon, 17 Apr 2017 16:38:51 -0400 Subject: Remove direct bitcoin calls from qt/rpcconsole.cpp --- src/interface/node.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/interface/node.cpp') diff --git a/src/interface/node.cpp b/src/interface/node.cpp index 740878b675..2f0114f5e4 100644 --- a/src/interface/node.cpp +++ b/src/interface/node.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include +#include class CWallet; @@ -114,6 +116,29 @@ class NodeImpl : public Node } return false; } + bool ban(const CNetAddr& net_addr, BanReason reason, int64_t ban_time_offset) override + { + if (g_connman) { + g_connman->Ban(net_addr, reason, ban_time_offset); + return true; + } + return false; + } + bool unban(const CSubNet& ip) override + { + if (g_connman) { + g_connman->Unban(ip); + return true; + } + return false; + } + bool disconnect(NodeId id) override + { + if (g_connman) { + return g_connman->DisconnectNode(id); + } + return false; + } int64_t getTotalBytesRecv() override { return g_connman ? g_connman->GetTotalBytesRecv() : 0; } int64_t getTotalBytesSent() override { return g_connman ? g_connman->GetTotalBytesSent() : 0; } size_t getMempoolSize() override { return ::mempool.size(); } @@ -160,6 +185,17 @@ class NodeImpl : public Node } } bool getNetworkActive() override { return g_connman && g_connman->GetNetworkActive(); } + UniValue executeRpc(const std::string& command, const UniValue& params, const std::string& uri) override + { + JSONRPCRequest req; + req.params = params; + req.strMethod = command; + req.URI = uri; + return ::tableRPC.execute(req); + } + std::vector listRpcCommands() override { return ::tableRPC.listCommands(); } + void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); } + void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); } std::unique_ptr handleInitMessage(InitMessageFn fn) override { return MakeHandler(::uiInterface.InitMessage.connect(fn)); -- cgit v1.2.3