protocol

package
v0.0.7-alphanet Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	StatusMsg = iota
	NewBlockHashesMsg
	TxMsg
	GetBlockHashesMsg
	BlockHashesMsg
	GetBlocksMsg
	BlocksMsg
	NewBlockMsg
	GetBlockHashesFromNumberMsg
)

eth protocol message codes

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIdMismatch
	ErrGenesisBlockMismatch
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrSuspendedPeer
)
View Source
const (
	ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
)

Variables

View Source
var ProtocolLengths = []uint64{9}

Number of implemented message corresponding to different protocol versions.

View Source
var ProtocolVersions = []uint{61}

Supported versions of the eth protocol (first is primary).

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster interface {
	SyncInfo() *SyncInfo
	CreateMomentum(*nom.MomentumTransaction)
	CreateAccountBlock(*nom.AccountBlockTransaction)
}

func NewBroadcaster

func NewBroadcaster(chain chain.Chain, protocol *ProtocolManager) Broadcaster

type ChainBridge

type ChainBridge interface {
	// contains filtered or unexported methods
}

func NewChainBridge

func NewChainBridge(chain chain.Chain, consensus consensus.Consensus, verifier verifier.Verifier, supervisor *vm.Supervisor) ChainBridge

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(minPeers int, networkId uint64, bridge ChainBridge) *ProtocolManager

NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable with the ethereum network.

func (*ProtocolManager) BroadcastAccountBlock

func (pm *ProtocolManager) BroadcastAccountBlock(tx *nom.AccountBlock)

BroadcastAccountBlock will propagate a transaction to all peers which are not known to already have the given transaction.

func (*ProtocolManager) BroadcastMomentum

func (pm *ProtocolManager) BroadcastMomentum(detailed *nom.DetailedMomentum, propagate bool)

BroadcastMomentum will propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start()

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) SyncInfo

func (pm *ProtocolManager) SyncInfo() *SyncInfo

type SyncInfo

type SyncInfo struct {
	State         SyncState `json:"state"`
	CurrentHeight uint64    `json:"currentHeight"`
	TargetHeight  uint64    `json:"targetHeight"`
}

type SyncState

type SyncState int
const (
	Unknown SyncState = iota
	Syncing
	SyncDone
	NotEnoughPeers
)

Directories

Path Synopsis
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
Package fetcher contains the block announcement based synchonisation.
Package fetcher contains the block announcement based synchonisation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL