Documentation ¶
Index ¶
- type DefaultHeaderLoader
- func (d *DefaultHeaderLoader) HeaderByHash(ctx context.Context, hash gethCommon.Hash) (*gethTypes.Header, error)
- func (d *DefaultHeaderLoader) HeaderByNumber(ctx context.Context, number *big.Int) (*gethTypes.Header, error)
- func (d *DefaultHeaderLoader) SubscribeNewHead(ctx context.Context, ch chan<- *gethTypes.Header) (ethereum.Subscription, error)
- type HeaderCache
- type HeaderCacheItem
- type HeaderLoader
- type Syncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultHeaderLoader ¶
type DefaultHeaderLoader struct {
// contains filtered or unexported fields
}
func NewHeaderLoader ¶
func NewHeaderLoader(client *ethclient.Client) *DefaultHeaderLoader
func (*DefaultHeaderLoader) HeaderByHash ¶
func (d *DefaultHeaderLoader) HeaderByHash(ctx context.Context, hash gethCommon.Hash) (*gethTypes.Header, error)
func (*DefaultHeaderLoader) HeaderByNumber ¶
func (*DefaultHeaderLoader) SubscribeNewHead ¶
type HeaderCache ¶
type HeaderCache struct {
// contains filtered or unexported fields
}
This is used to store the latest headers as they are published. Up to `numHeightsToTrack` heights are stored. Once this number is reached, an old height is pruned each time a new height is added. The current stored height range is given by [minHeight, maxHeight].
func NewHeaderCache ¶
func NewHeaderCache(numHeightsToTrack uint64) *HeaderCache
func (*HeaderCache) Get ¶
func (hc *HeaderCache) Get(hash gethCommon.Hash) (*HeaderCacheItem, bool)
type HeaderCacheItem ¶
type HeaderLoader ¶
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer retrieves headers starting at a given initial height up to the latest. Headers are sent to the channel `headers` in order. If the initial height is old, (finalized) headers in the canonical chain will be forwarded in quick succession until we catch up with the unfinalized headers. From that point onwards, headers on all forks are forwarded. A header is considered final if it has at least `descendantsUntilFinal` descendants.