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.
Click to show internal directories.
Click to hide internal directories.