sync

package
v0.0.0-...-d3f78af Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sync is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackwardSync

func BackwardSync(ctx context.Context, b backend.Backend, blkSrc BlockSource, target *types.Block, maxBlksToQuery uint64) error

BackwardSync syncs from target backward to current head.

func ForwardSync

func ForwardSync(ctx context.Context, b backend.Backend, blkSrc BlockSource, target uint64) error

ForwardSync syncs from current head to target number.

Types

type BlockSource

type BlockSource interface {
	// BlockByHash returns the given full block.
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

	// BlockByNumber returns a block from the current canonical chain. If number is nil, the
	// latest known block is returned.
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

	// HeaderByNumber returns a block header from the current canonical chain. If number is
	// nil, the latest known header is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

	// Close closes the block source.
	Close()
}

type MockBlockSource

type MockBlockSource struct {
	// contains filtered or unexported fields
}

MockBlockSource is a mock of BlockSource interface.

func NewMockBlockSource

func NewMockBlockSource(ctrl *gomock.Controller) *MockBlockSource

NewMockBlockSource creates a new mock instance.

func (*MockBlockSource) BlockByHash

func (m *MockBlockSource) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

BlockByHash mocks base method.

func (*MockBlockSource) BlockByNumber

func (m *MockBlockSource) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

BlockByNumber mocks base method.

func (*MockBlockSource) Close

func (m *MockBlockSource) Close()

Close mocks base method.

func (*MockBlockSource) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBlockSource) HeaderByNumber

func (m *MockBlockSource) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber mocks base method.

type MockBlockSourceMockRecorder

type MockBlockSourceMockRecorder struct {
	// contains filtered or unexported fields
}

MockBlockSourceMockRecorder is the mock recorder for MockBlockSource.

func (*MockBlockSourceMockRecorder) BlockByHash

func (mr *MockBlockSourceMockRecorder) BlockByHash(ctx, hash any) *gomock.Call

BlockByHash indicates an expected call of BlockByHash.

func (*MockBlockSourceMockRecorder) BlockByNumber

func (mr *MockBlockSourceMockRecorder) BlockByNumber(ctx, number any) *gomock.Call

BlockByNumber indicates an expected call of BlockByNumber.

func (*MockBlockSourceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockBlockSourceMockRecorder) HeaderByNumber

func (mr *MockBlockSourceMockRecorder) HeaderByNumber(ctx, number any) *gomock.Call

HeaderByNumber indicates an expected call of HeaderByNumber.

Jump to

Keyboard shortcuts

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