Documentation ¶
Index ¶
- Constants
- Variables
- func Factory(ctx context.Context, logger hclog.Logger, m interface{}, ...) (protocol.Backend, error)
- type AckMessage
- type Backend
- func (b *Backend) Add(conn net.Conn, peer *network.Peer) (network.ProtocolHandler, error)
- func (b *Backend) FindCommonAncestor(peer *Ethereum, height *types.Header) (*types.Header, error)
- func (b *Backend) GetStatus() (*Status, error)
- func (b *Backend) Protocols() []*network.Protocol
- func (b *Backend) Run()
- func (b *Backend) WatchMinedBlocks(watch chan *sealer.SealedNotify)
- type Blockchain
- type Ethereum
- func (e *Ethereum) Close() error
- func (e *Ethereum) DoRequest(req *Request, q *Queue3) error
- func (e *Ethereum) Header() types.Hash
- func (e *Ethereum) Info() (map[string]interface{}, error)
- func (e *Ethereum) Init(peer *network.Peer, status *Status) error
- func (e *Ethereum) Status() *Status
- func (e *Ethereum) ValidateDAOBlock() error
- type NotifyMsg
- type Queue3
- func (q *Queue3) AddSkeleton(headers []*types.Header, lastSlotNum uint64) error
- func (q *Queue3) DeliverJob(req *Request, p *fastrlp.Parser, v *fastrlp.Value) error
- func (q *Queue3) GetJob(req *Request) bool
- func (q *Queue3) Head() *types.Header
- func (q *Queue3) IsCompleted() bool
- func (q *Queue3) Len() int
- func (q *Queue3) Next() *types.Block
- func (q *Queue3) ReassignJob(req *Request)
- func (q *Queue3) Wait()
- type Request
- type RequestStatus
- type RequestType
- type Slot
- type Status
Constants ¶
const ( StatusMsg ethMessage = 0x00 NewBlockHashesMsg = 0x01 TxMsg = 0x02 GetBlockHeadersMsg = 0x03 BlockHeadersMsg = 0x04 GetBlockBodiesMsg = 0x05 BlockBodiesMsg = 0x06 NewBlockMsg = 0x07 GetNodeDataMsg = 0x0d NodeDataMsg = 0x0e GetReceiptsMsg = 0x0f ReceiptsMsg = 0x10 )
Variables ¶
var ETH63 = network.ProtocolSpec{
Name: "eth",
Version: 63,
Length: 17,
}
ETH63 is the Fast synchronization protocol
Functions ¶
Types ¶
type AckMessage ¶
type AckMessage struct { Error error Result interface{} }
AckMessage is the ack message
func (*AckMessage) Completed ¶
func (a *AckMessage) Completed() bool
Completed returns true if there is a value in the response
type Backend ¶
type Backend struct { NetworkID uint64 // contains filtered or unexported fields }
Backend is the ethereum backend
func NewBackend ¶
func NewBackend(minimal *minimal.Minimal, logger hclog.Logger, blockchain *blockchain.Blockchain) (*Backend, error)
NewBackend creates a new ethereum backend
func (*Backend) FindCommonAncestor ¶
FindCommonAncestor finds the common ancestor with the peer and the syncer connection
func (*Backend) WatchMinedBlocks ¶
func (b *Backend) WatchMinedBlocks(watch chan *sealer.SealedNotify)
type Blockchain ¶
type Blockchain interface { GetReceiptsByHash(types.Hash) []*types.Receipt GetHeaderByHash(hash types.Hash) (*types.Header, bool) GetHeaderByNumber(number uint64) (*types.Header, bool) GetBodyByHash(types.Hash) (*types.Body, bool) GetConsensus() consensus.Consensus }
Blockchain interface are the methods required by the handler
type Ethereum ¶
type Ethereum struct { // header data HeaderHash types.Hash HeaderDiff *big.Int HeaderNumber *big.Int // contains filtered or unexported fields }
Ethereum is the protocol for etheruem
func NewEthereumProtocol ¶
func NewEthereumProtocol(session network.Session, peerID string, logger hclog.Logger, conn net.Conn, blockchain *blockchain.Blockchain) *Ethereum
NewEthereumProtocol creates the ethereum protocol
func (*Ethereum) ValidateDAOBlock ¶
ValidateDAOBlock queries the DAO block
type Queue3 ¶
type Queue3 struct {
// contains filtered or unexported fields
}
Queue3 stores the data in epochs, one epoch at a time, only when one epoch is consumed we proceed to consume the next one
func (*Queue3) AddSkeleton ¶
AddSkeleton adds a skeleton to the queue
func (*Queue3) DeliverJob ¶
DeliverJob delivers a job
func (*Queue3) IsCompleted ¶
IsCompleted returns true if the queue is completed
func (*Queue3) ReassignJob ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is a request from the skeleton queue to retrieve information
type RequestStatus ¶
type RequestStatus uint
RequestStatus is the status of the items in the slot (RENAME)
const ( // Completed if the item has been fully downloaded Completed RequestStatus = iota // OnFly if the item is being requested OnFly // Pending if the item has to be scheduled for downloading Pending )
func (RequestStatus) String ¶
func (r RequestStatus) String() string
type RequestType ¶
type RequestType uint
const ( Headers RequestType = iota Bodies Receipts NodeData )
func (*RequestType) String ¶
func (r *RequestType) String() string
type Slot ¶
Slot is the slots in the epoch, groups of 190
func (*Slot) Deliver ¶
func (s *Slot) Deliver(q *Queue3, req *Request, p *fastrlp.Parser, v *fastrlp.Value, isLast bool) error
Deliver delivers a response