Skip to content

Commit

Permalink
Fix getaddednodeinfo RPC call with dns=false
Browse files Browse the repository at this point in the history
The getaddednodeinfo RPC call, when invoked with the dns flag set to
false, returns a malformed JSON object with duplicate keys.

Change this to return an array of objects with one key as
shown in the help message.

Fixes #3581.
  • Loading branch information
laanwj committed Jan 29, 2014
1 parent e16ee00 commit 4412c5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/rpcnet.cpp
Expand Up @@ -255,16 +255,18 @@ Value getaddednodeinfo(const Array& params, bool fHelp)
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
}

Array ret;
if (!fDns)
{
Object ret;
BOOST_FOREACH(string& strAddNode, laddedNodes)
ret.push_back(Pair("addednode", strAddNode));
{
Object obj;
obj.push_back(Pair("addednode", strAddNode));
ret.push_back(obj);
}
return ret;
}

Array ret;

list<pair<string, vector<CService> > > laddedAddreses(0);
BOOST_FOREACH(string& strAddNode, laddedNodes)
{
Expand Down

0 comments on commit 4412c5a

Please sign in to comment.