blocksync

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: GPL-3.0, LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockSyncer

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

func NewSyncer

func NewSyncer(client statesyncclient.Client, db ethdb.Database, fromHash common.Hash, fromHeight uint64, blocksToFetch uint64) (*BlockSyncer, error)

func (*BlockSyncer) ID

func (*BlockSyncer) ID() string

ID returns the stable identifier for this sync task.

func (*BlockSyncer) Name

func (*BlockSyncer) Name() string

Name returns the human-readable name for this sync task.

func (*BlockSyncer) Sync

func (s *BlockSyncer) Sync(ctx context.Context) error

Sync fetches (up to) BlocksToFetch blocks from peers using Client and writes them to disk. the process begins with FromHash and it fetches parents recursively. fetching starts from the first ancestor not found on disk

TODO: We could inspect the database more accurately to ensure we never fetch any blocks that are locally available. We could also prevent overrequesting blocks, if the number of blocks needed to be fetched isn't a multiple of blocksPerRequest.

Jump to

Keyboard shortcuts

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