Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSyncHandler ¶
func NewSyncHandler( provider SyncDataProvider, evmTrieDB *trie.Database, atomicTrieDB *trie.Database, networkCodec codec.Manager, stats stats.HandlerStats, ) message.RequestHandler
NewSyncHandler constructs the handler for serving state sync.
Types ¶
type BlockRequestHandler ¶
type BlockRequestHandler struct {
// contains filtered or unexported fields
}
BlockRequestHandler is a peer.RequestHandler for message.BlockRequest serving requested blocks starting at specified hash
func NewBlockRequestHandler ¶
func NewBlockRequestHandler(blockProvider BlockProvider, codec codec.Manager, handlerStats stats.BlockRequestHandlerStats) *BlockRequestHandler
func (*BlockRequestHandler) OnBlockRequest ¶
func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockRequest message.BlockRequest) ([]byte, error)
OnBlockRequest handles incoming message.BlockRequest, returning blocks as requested Never returns error Expects returned errors to be treated as FATAL Returns empty response or subset of requested blocks if ctx expires during fetch Assumes ctx is active
type CodeRequestHandler ¶
type CodeRequestHandler struct {
// contains filtered or unexported fields
}
CodeRequestHandler is a peer.RequestHandler for message.CodeRequest serving requested contract code bytes
func NewCodeRequestHandler ¶
func NewCodeRequestHandler(codeReader ethdb.KeyValueReader, codec codec.Manager, stats stats.CodeRequestHandlerStats) *CodeRequestHandler
func (*CodeRequestHandler) OnCodeRequest ¶
func (n *CodeRequestHandler) OnCodeRequest(_ context.Context, nodeID ids.NodeID, requestID uint32, codeRequest message.CodeRequest) ([]byte, error)
OnCodeRequest handles request to retrieve contract code by its hash in message.CodeRequest Never returns error Returns nothing if code hash is not found Expects returned errors to be treated as FATAL Assumes ctx is active
type LeafsRequestHandler ¶
type LeafsRequestHandler struct {
// contains filtered or unexported fields
}
LeafsRequestHandler is a peer.RequestHandler for types.LeafsRequest serving requested trie data
func NewLeafsRequestHandler ¶
func NewLeafsRequestHandler(trieDB *trie.Database, snapshotProvider SnapshotProvider, codec codec.Manager, syncerStats stats.LeafsRequestHandlerStats) *LeafsRequestHandler
func (*LeafsRequestHandler) OnLeafsRequest ¶
func (lrh *LeafsRequestHandler) OnLeafsRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, leafsRequest message.LeafsRequest) ([]byte, error)
OnLeafsRequest returns encoded message.LeafsResponse for a given message.LeafsRequest Returns leaves with proofs for specified (Start-End) (both inclusive) ranges Returned message.LeafsResponse may contain partial leaves within requested Start and End range if: - ctx expired while fetching leafs - number of leaves read is greater than Limit (message.LeafsRequest) Specified Limit in message.LeafsRequest is overridden to maxLeavesLimit if it is greater than maxLeavesLimit Expects returned errors to be treated as FATAL Never returns errors Expects NodeType to be one of message.AtomicTrieNode or message.StateTrieNode Returns nothing if NodeType is invalid or requested trie root is not found Assumes ctx is active
type SnapshotProvider ¶
type SyncDataProvider ¶
type SyncDataProvider interface { BlockProvider SnapshotProvider }
type TestBlockProvider ¶
type TestSnapshotProvider ¶
func (*TestSnapshotProvider) Snapshots ¶
func (t *TestSnapshotProvider) Snapshots() *snapshot.Tree