node

package
v0.0.0-...-eb934a0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHeaderTraversalAheadOfProvider            = errors.New("the HeaderTraversal's internal state is ahead of the provider")
	ErrHeaderTraversalAndProviderMismatchedState = errors.New("the HeaderTraversal and provider have diverged in state")
)

Functions

This section is empty.

Types

type EthClient

type EthClient interface {
	FinalizedBlockHeight() (*big.Int, error)

	BlockHeadersByRange(*big.Int, *big.Int) ([]*types.Header, error)
	BlockHeaderByHash(common.Hash) (*types.Header, error)

	RawRpcClient() *rpc.Client
}

func NewEthClient

func NewEthClient(rpcUrl string) (EthClient, error)

type HeaderTraversal

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

func NewHeaderTraversal

func NewHeaderTraversal(ethClient EthClient, fromHeader *types.Header) *HeaderTraversal

NewHeaderTraversal instantiates a new instance of HeaderTraversal against the supplied rpc client. The HeaderTraversal will start fetching blocks starting from the supplied header unless nil, indicating genesis.

func (*HeaderTraversal) NextFinalizedHeaders

func (f *HeaderTraversal) NextFinalizedHeaders(maxSize uint64) ([]*types.Header, error)

NextFinalizedHeaders retrives the next set of headers that have been marked as finalized by the connected client, bounded by the supplied size

Jump to

Keyboard shortcuts

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