diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs index b567abd394b..c7fc2bbfd55 100644 --- a/src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs +++ b/src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs @@ -15,7 +15,7 @@ public class PeerInfo public string Host { get; set; } public int Port { get; set; } public string Address { get; set; } - public bool IsBootnode { get; set; } + public bool IsBootnode { get; set; } // change to BootNode (capitalize "N")? public bool IsTrusted { get; set; } public bool IsStatic { get; set; } public string Enode { get; set; } @@ -24,6 +24,8 @@ public class PeerInfo public string EthDetails { get; set; } public string LastSignal { get; set; } + public bool Inbound { get; set; } + public PeerInfo() { } @@ -43,13 +45,13 @@ public PeerInfo(Peer peer, bool includeDetails) IsBootnode = peer.Node.IsBootnode; IsStatic = peer.Node.IsStatic; Enode = peer.Node.ToString(Node.Format.ENode); + Inbound = peer.InSession is not null && peer.InSession.Direction == ConnectionDirection.In; // assumes one of InSession/Outsession is always set.? - if (includeDetails) - { - ClientType = peer.Node.ClientType.ToString(); - EthDetails = peer.Node.EthDetails; - LastSignal = (peer.InSession ?? peer.OutSession)?.LastPingUtc.ToString(CultureInfo.InvariantCulture); - } + if (!includeDetails) return; + + ClientType = peer.Node.ClientType.ToString(); + EthDetails = peer.Node.EthDetails; + LastSignal = (peer.InSession ?? peer.OutSession)?.LastPingUtc.ToString(CultureInfo.InvariantCulture); } } }