Documentation ¶
Index ¶
Constants ¶
const (
NewVoteMsg = 0x00
)
const ProtocolName = "ronin"
ProtocolName is the official short name of the `ronin` protocol used during devp2p capability negotiation.
const (
Ronin1 = 1
)
Constants to match up protocol versions and messages
Variables ¶
var ProtocolVersions = []uint{Ronin1}
ProtocolVersions are the supported versions of the `ronin` protocol
Functions ¶
func Handle ¶
Handle is the callback invoked to manage the life cycle of a `ronin` peer. When this function terminates, the peer is disconnected.
func MakeProtocols ¶
Types ¶
type Backend ¶
type Backend interface { // RunPeer is invoked when a peer joins on the `ronin` protocol. The handler // should do any peer maintenance work, handshakes and validations. If all // is passed, control should be given back to the `handler` to process the // inbound messages going forward. RunPeer(peer *Peer, handler Handler) error // PeerInfo retrieves all known `ronin` information about a peer. PeerInfo(id enode.ID) interface{} // Handle is a callback to be invoked when a data packet is received from // the remote peer. Only packets not consumed by the protocol handler will // be forwarded to the backend. Handle(peer *Peer, packet Packet) error }
type Handler ¶
Handler is a callback to invoke from an outside runner after the boilerplate exchanges have passed.
type NewVotePacket ¶
type NewVotePacket struct {
Vote []*types.RawVoteEnvelope
}
func (*NewVotePacket) Kind ¶
func (*NewVotePacket) Kind() byte
func (*NewVotePacket) Name ¶
func (*NewVotePacket) Name() string
type NodeInfo ¶
type NodeInfo struct{}
NodeInfo represents a short summary of the `ronin` sub-protocol metadata known about the host peer.
type Packet ¶
type Packet interface { Name() string // Name returns a string corresponding to the message type. Kind() byte // Kind returns the message type. }
Packet represents a p2p message in the `ronin` protocol.
type Peer ¶
type Peer struct { *p2p.Peer // The embedded P2P package peer // contains filtered or unexported fields }
Peer is a collection of relevant information we have about a `ronin` peer.
func (*Peer) AsyncSendNewVote ¶
func (p *Peer) AsyncSendNewVote(vote *types.VoteEnvelope)
AsyncSendNewVote puts the vote into the batch vote goroutine.
func (*Peer) KnownFinalityVote ¶
KnownFinalityVote returns whether peer is known to already have a vote.