Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
func HeadersByRange ¶
func HeadersByRange(ctx context.Context, c client.Client, startHeight, endHeight *big.Int) ([]types.Header, error)
HeadersByRange will retrieve block headers within the specified range -- inclusive. No restrictions are placed on the range such as blocks in the "latest", "safe" or "finalized" states. If the specified range is too large, `endHeight > latest`, the resulting list is truncated to the available headers
Types ¶
type HeaderTraversal ¶
type HeaderTraversal struct {
// contains filtered or unexported fields
}
func NewHeaderTraversal ¶
func NewHeaderTraversal(client client.Client, fromHeader *types.Header, confDepth *big.Int) *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) LastTraversedHeader ¶
func (f *HeaderTraversal) LastTraversedHeader() *types.Header
LastTraversedHeader returns the last header traversed.
- This is useful for testing the state of the HeaderTraversal
- LastTraversedHeader may be << LatestHeader depending on the number headers traversed via `NextHeaders`.
func (*HeaderTraversal) LatestHeader ¶
func (f *HeaderTraversal) LatestHeader() *types.Header
LatestHeader returns the latest header reported by underlying eth client as headers are traversed via `NextHeaders`.
func (*HeaderTraversal) NextHeaders ¶
func (f *HeaderTraversal) NextHeaders(maxSize uint64) ([]types.Header, error)
NextHeaders retrieves the next set of headers that have been marked as finalized by the connected client, bounded by the supplied size
type Logs ¶
func FilterLogsSafe ¶
FilterLogsSafe returns logs that fit the query parameters. The underlying request is a batch request including `eth_getBlockByNumber` to allow the caller to check that connected node has the state necessary to fulfill this request