Documentation ¶
Index ¶
Constants ¶
const ( BscCapMsg = 0x00 // jumbo capability msg used upon handshake VotesMsg = 0x01 )
const (
Jumbo1 = 1
)
Constants to match up protocol versions and messages
const ProtocolName = "jumbo"
ProtocolName is the official short name of the `jumbo` protocol used during devp2p capability negotiation.
Variables ¶
var ( IngressRegistrationErrorMeter = metrics.NewRegisteredMeter(ingressRegistrationErrorName, nil) EgressRegistrationErrorMeter = metrics.NewRegisteredMeter(egressRegistrationErrorName, nil) )
var ProtocolVersions = []uint{Jumbo1}
ProtocolVersions are the supported versions of the `jumbo` protocol (first is primary).
Functions ¶
Types ¶
type Backend ¶
type Backend interface { // Chain retrieves the blockchain object to serve data. Chain() *core.BlockChain // RunPeer is invoked when a peer joins on the `jumbo` 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 `jumbo` 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 BscCapPacket ¶
BscCapPacket is the network packet for bsc capability message.
func (*BscCapPacket) Kind ¶
func (*BscCapPacket) Kind() byte
func (*BscCapPacket) Name ¶
func (*BscCapPacket) Name() string
type Handler ¶
Handler is a callback to invoke from an outside runner after the boilerplate exchanges have passed.
type NodeInfo ¶
type NodeInfo struct{}
NodeInfo represents a short summary of the `jumbo` 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 `jumbo` 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 `jumbo` peer.
func (*Peer) AsyncSendVotes ¶
func (p *Peer) AsyncSendVotes(votes []*types.VoteEnvelope)
AsyncSendVotes queues a batch of vote hashes for propagation to a remote peer. If the peer's broadcast queue is full, the event is silently dropped.
func (*Peer) Close ¶
func (p *Peer) Close()
Close signals the broadcast goroutine to terminate. Only ever call this if you created the peer yourself via NewPeer. Otherwise let whoever created it clean it up!
func (*Peer) IsOverLimitAfterReceiving ¶
Step into the next period when secondsPerPeriod seconds passed, Otherwise, check whether the number of received votes extra (secondsPerPeriod * receiveRateLimitPerSecond)
type VotesPacket ¶
type VotesPacket struct {
Votes []*types.VoteEnvelope
}
VotesPacket is the network packet for votes record.
func (*VotesPacket) Kind ¶
func (*VotesPacket) Kind() byte
func (*VotesPacket) Name ¶
func (*VotesPacket) Name() string