-
Notifications
You must be signed in to change notification settings - Fork 0
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
Enable enr field in GetPeers and GetPeerById (#8641) #155
Conversation
* Expose discovery NodeId to DiscoveryPeer and LibP2PPeer (Consensys#38) * Add DiscoveryPeer.getNodeId() * Add Eth2Peer.getDiscoveryNodeId() method. * Refactoring, discovery updated to 24.9.1 --------- Co-authored-by: Anton Nashatyrev <Nashatyrev@users.noreply.github.com>
import java.util.Optional; | ||
import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; | ||
|
||
public record Eth2PeerWithEnr(Eth2Peer peer, Optional<String> enr) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the enr
is optional, does it make sense to just add this field to EthPeer
?
import org.apache.tuweni.units.bigints.UInt256; | ||
import tech.pegasys.teku.networking.p2p.peer.Peer; | ||
|
||
public interface DiscoveryNodeIdExtractor { | ||
UInt256 calculateDiscoveryNodeId(Peer peer); | ||
Optional<UInt256> calculateDiscoveryNodeId(Peer peer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Libp2pPeer
the nodeId
would always exist. We have no other Peer
implementations aside of libp2p. Do we really need to handle hypothetical case of absent NodeId
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
just a couple of nits for discussion
Decided to not get too far from master and keep it |
Cherry-picked from master