@@ -97,9 +97,9 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
9797 " \" bytesrecv\" : n, (numeric) The total bytes received\n "
9898 " \" conntime\" : ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n "
9999 " \" timeoffset\" : ttt, (numeric) The time offset in seconds\n "
100- " \" pingtime\" : n, (numeric) ping time\n "
101- " \" minping\" : n, (numeric) minimum observed ping time\n "
102- " \" pingwait\" : n, (numeric) ping wait\n "
100+ " \" pingtime\" : n, (numeric) ping time (if available) \n "
101+ " \" minping\" : n, (numeric) minimum observed ping time (if any at all) \n "
102+ " \" pingwait\" : n, (numeric) ping wait (if non-zero) \n "
103103 " \" version\" : v, (numeric) The peer version, such as 7001\n "
104104 " \" subver\" : \" /Satoshi:0.8.5/\" , (string) The string version\n "
105105 " \" inbound\" : true|false, (boolean) Inbound (true) or Outbound (false)\n "
@@ -150,8 +150,10 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
150150 obj.push_back (Pair (" bytesrecv" , stats.nRecvBytes ));
151151 obj.push_back (Pair (" conntime" , stats.nTimeConnected ));
152152 obj.push_back (Pair (" timeoffset" , stats.nTimeOffset ));
153- obj.push_back (Pair (" pingtime" , stats.dPingTime ));
154- obj.push_back (Pair (" minping" , stats.dPingMin ));
153+ if (stats.dPingTime > 0.0 )
154+ obj.push_back (Pair (" pingtime" , stats.dPingTime ));
155+ if (stats.dPingMin < std::numeric_limits<int64_t >::max ()/1e6 )
156+ obj.push_back (Pair (" minping" , stats.dPingMin ));
155157 if (stats.dPingWait > 0.0 )
156158 obj.push_back (Pair (" pingwait" , stats.dPingWait ));
157159 obj.push_back (Pair (" version" , stats.nVersion ));
0 commit comments