tuweni / org.apache.tuweni.devp2p / Peer

Peer

interface Peer (source)

An Ethereum P2P network peer.

Properties

endpoint

abstract val endpoint: Endpoint?

The endpoint for communicating with this peer, if known.

enr

abstract val enr: EthereumNodeRecord?

The Ethereum Node Record associated with the peer, if known.

lastSeen

abstract val lastSeen: Long?

The time this peer was last seen at its current endpoint, in milliseconds since the epoch.

lastVerified

abstract val lastVerified: Long?

The last time the current endpoint of this peer was verified, in milliseconds since the epoch.

nodeId

abstract val nodeId: PublicKey

The nodeId for this peer.

Functions

getEndpoint

abstract fun getEndpoint(ifVerifiedOnOrAfter: Long): Endpoint?

Get the endpoint for this peer, if it has been verified on or after a specified time.

seenAt

abstract fun seenAt(time: Long): Unit

Set the lastSeen time to the current time.

updateENR

abstract fun updateENR(record: EthereumNodeRecord, time: Long): Unit

Update the peer's ENR.

updateEndpoint

abstract fun updateEndpoint(endpoint: Endpoint, time: Long, ifVerifiedBefore: Long? = null): Endpoint

Update the peer with a new endpoint.

verifyEndpoint

abstract fun verifyEndpoint(endpoint: Endpoint, time: Long): Boolean

Set the lastVerified and lastSeen time to the provided time, if the endpoint matches.