File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,14 @@ static RPCHelpMan getpeerinfo()
196196 UniValue obj (UniValue::VOBJ);
197197 CNodeStateStats statestats;
198198 bool fStateStats = peerman.GetNodeStateStats (stats.nodeid , statestats);
199+ // GetNodeStateStats() requires the existence of a CNodeState and a Peer object
200+ // to succeed for this peer. These are created at connection initialisation and
201+ // exist for the duration of the connection - except if there is a race where the
202+ // peer got disconnected in between the GetNodeStats() and the GetNodeStateStats()
203+ // calls. In this case, the peer doesn't need to be reported here.
204+ if (!fStateStats ) {
205+ continue ;
206+ }
199207 obj.pushKV (" id" , stats.nodeid );
200208 obj.pushKV (" addr" , stats.m_addr_name );
201209 if (stats.addrBind .IsValid ()) {
You can’t perform that action at this time.
0 commit comments