mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Remove direct bitcoin calls from qt/rpcconsole.cpp
This commit is contained in:
parent
3034a462a5
commit
582daf6d22
6 changed files with 137 additions and 67 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <netaddress.h>
|
||||
#include <netbase.h>
|
||||
#include <primitives/block.h>
|
||||
#include <rpc/server.h>
|
||||
#include <scheduler.h>
|
||||
#include <sync.h>
|
||||
#include <txmempool.h>
|
||||
|
|
@ -34,6 +35,7 @@
|
|||
|
||||
#include <atomic>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <univalue.h>
|
||||
|
||||
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<std::string> listRpcCommands() override { return ::tableRPC.listCommands(); }
|
||||
void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); }
|
||||
void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); }
|
||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
|
||||
{
|
||||
return MakeHandler(::uiInterface.InitMessage.connect(fn));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue