mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge pull request #6271
60dbe73
New RPC command disconnectnode (Alex van der Peet)
This commit is contained in:
commit
754aae5148
@ -214,6 +214,28 @@ UniValue addnode(const UniValue& params, bool fHelp)
|
|||||||
return NullUniValue;
|
return NullUniValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue disconnectnode(const UniValue& params, bool fHelp)
|
||||||
|
{
|
||||||
|
if (fHelp || params.size() != 1)
|
||||||
|
throw runtime_error(
|
||||||
|
"disconnectnode \"node\" \n"
|
||||||
|
"\nImmediately disconnects from the specified node.\n"
|
||||||
|
"\nArguments:\n"
|
||||||
|
"1. \"node\" (string, required) The node (see getpeerinfo for nodes)\n"
|
||||||
|
"\nExamples:\n"
|
||||||
|
+ HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
|
||||||
|
+ HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"")
|
||||||
|
);
|
||||||
|
|
||||||
|
CNode* pNode = FindNode(params[0].get_str());
|
||||||
|
if (pNode == NULL)
|
||||||
|
throw JSONRPCError(RPC_CLIENT_NODE_NOT_CONNECTED, "Node not found in connected nodes");
|
||||||
|
|
||||||
|
pNode->CloseSocketDisconnect();
|
||||||
|
|
||||||
|
return NullUniValue;
|
||||||
|
}
|
||||||
|
|
||||||
UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||||
|
@ -63,6 +63,7 @@ enum RPCErrorCode
|
|||||||
RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks
|
RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks
|
||||||
RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added
|
RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added
|
||||||
RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before
|
RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before
|
||||||
|
RPC_CLIENT_NODE_NOT_CONNECTED = -29, //! Node to disconnect not found in connected nodes
|
||||||
|
|
||||||
//! Wallet errors
|
//! Wallet errors
|
||||||
RPC_WALLET_ERROR = -4, //! Unspecified problem with wallet (key not found etc.)
|
RPC_WALLET_ERROR = -4, //! Unspecified problem with wallet (key not found etc.)
|
||||||
|
@ -273,6 +273,7 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
/* P2P networking */
|
/* P2P networking */
|
||||||
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
||||||
{ "network", "addnode", &addnode, true },
|
{ "network", "addnode", &addnode, true },
|
||||||
|
{ "network", "disconnectnode", &disconnectnode, true },
|
||||||
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
||||||
{ "network", "getconnectioncount", &getconnectioncount, true },
|
{ "network", "getconnectioncount", &getconnectioncount, true },
|
||||||
{ "network", "getnettotals", &getnettotals, true },
|
{ "network", "getnettotals", &getnettotals, true },
|
||||||
|
@ -151,6 +151,7 @@ extern UniValue getconnectioncount(const UniValue& params, bool fHelp); // in rp
|
|||||||
extern UniValue getpeerinfo(const UniValue& params, bool fHelp);
|
extern UniValue getpeerinfo(const UniValue& params, bool fHelp);
|
||||||
extern UniValue ping(const UniValue& params, bool fHelp);
|
extern UniValue ping(const UniValue& params, bool fHelp);
|
||||||
extern UniValue addnode(const UniValue& params, bool fHelp);
|
extern UniValue addnode(const UniValue& params, bool fHelp);
|
||||||
|
extern UniValue disconnectnode(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getaddednodeinfo(const UniValue& params, bool fHelp);
|
extern UniValue getaddednodeinfo(const UniValue& params, bool fHelp);
|
||||||
extern UniValue getnettotals(const UniValue& params, bool fHelp);
|
extern UniValue getnettotals(const UniValue& params, bool fHelp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user