Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Inbound field to admin_peers rpc call response #7443

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change, but what is the standard?

public bool IsTrusted { get; set; }
public bool IsStatic { get; set; }
public string Enode { get; set; }
Expand All @@ -24,6 +24,8 @@ public class PeerInfo
public string EthDetails { get; set; }
public string LastSignal { get; set; }

public bool Inbound { get; set; }

public PeerInfo()
{
}
Expand All @@ -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.?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all InSession should have direction.In


if (includeDetails)
{
ClientType = peer.Node.ClientType.ToString();
EthDetails = peer.Node.EthDetails;
LastSignal = (peer.InSession ?? peer.OutSession)?.LastPingUtc.ToString(CultureInfo.InvariantCulture);
}
if (!includeDetails) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal: I dislike jumping out from methods in the middle (it is okayish at the begining).


ClientType = peer.Node.ClientType.ToString();
EthDetails = peer.Node.EthDetails;
LastSignal = (peer.InSession ?? peer.OutSession)?.LastPingUtc.ToString(CultureInfo.InvariantCulture);
}
}
}