Make the dummy argument to getaddednodeinfo optional
This commit is contained in:
parent
f061415d12
commit
854f1af22e
3 changed files with 7 additions and 7 deletions
|
@ -63,6 +63,8 @@ UTXO set query (`GET /rest/getutxos/<checkmempool>/<txid>-<n>/<txid>-<n>/.../<tx
|
||||||
were changed to return status code HTTP_BAD_REQUEST (400) instead of HTTP_INTERNAL_SERVER_ERROR (500) when requests
|
were changed to return status code HTTP_BAD_REQUEST (400) instead of HTTP_INTERNAL_SERVER_ERROR (500) when requests
|
||||||
contain invalid parameters.
|
contain invalid parameters.
|
||||||
|
|
||||||
|
The first boolean argument to `getaddednodeinfo` has been removed. This is an incompatible change.
|
||||||
|
|
||||||
### Configuration and command-line options
|
### Configuration and command-line options
|
||||||
|
|
||||||
### Block and transaction handling
|
### Block and transaction handling
|
||||||
|
|
|
@ -26,7 +26,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
|
||||||
{
|
{
|
||||||
{ "stop", 0 },
|
{ "stop", 0 },
|
||||||
{ "setmocktime", 0 },
|
{ "setmocktime", 0 },
|
||||||
{ "getaddednodeinfo", 0 },
|
|
||||||
{ "generate", 0 },
|
{ "generate", 0 },
|
||||||
{ "generate", 1 },
|
{ "generate", 1 },
|
||||||
{ "generatetoaddress", 0 },
|
{ "generatetoaddress", 0 },
|
||||||
|
|
|
@ -269,14 +269,13 @@ UniValue disconnectnode(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
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)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"getaddednodeinfo dummy ( \"node\" )\n"
|
"getaddednodeinfo ( \"node\" )\n"
|
||||||
"\nReturns information about the given added node, or all added nodes\n"
|
"\nReturns information about the given added node, or all added nodes\n"
|
||||||
"(note that onetry addnodes are not listed here)\n"
|
"(note that onetry addnodes are not listed here)\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. dummy (boolean, required) Kept for historical purposes but ignored\n"
|
"1. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n"
|
||||||
"2. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n"
|
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
@ -299,10 +298,10 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
||||||
|
|
||||||
std::vector<AddedNodeInfo> vInfo = GetAddedNodeInfo();
|
std::vector<AddedNodeInfo> vInfo = GetAddedNodeInfo();
|
||||||
|
|
||||||
if (params.size() == 2) {
|
if (params.size() == 1) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (const AddedNodeInfo& info : vInfo) {
|
for (const AddedNodeInfo& info : vInfo) {
|
||||||
if (info.strAddedNode == params[1].get_str()) {
|
if (info.strAddedNode == params[0].get_str()) {
|
||||||
vInfo.assign(1, info);
|
vInfo.assign(1, info);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue