Merge pull request #4535

c4a321f Add peerid to getpeerinfo to allow correlation with the logs. (Gregory Maxwell)
This commit is contained in:
Wladimir J. van der Laan 2014-07-15 16:30:11 +02:00
commit 87e40799fd
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 2 additions and 0 deletions

View File

@ -79,6 +79,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
"\nbResult:\n"
"[\n"
" {\n"
" \"id\": n, (numeric) Peer index\n"
" \"addr\":\"host:port\", (string) The ip address and port of the peer\n"
" \"addrlocal\":\"ip:port\", (string) local address\n"
" \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n"
@ -113,6 +114,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
Object obj;
CNodeStateStats statestats;
bool fStateStats = GetNodeStateStats(stats.nodeid, statestats);
obj.push_back(Pair("id", stats.nodeid));
obj.push_back(Pair("addr", stats.addrName));
if (!(stats.addrLocal.empty()))
obj.push_back(Pair("addrlocal", stats.addrLocal));