initialsync

package
v0.0.0-...-c85edb6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package initialsync is run by the beacon node when the local chain is behind the network's longest chain. Initial sync works as follows: The node requests for the slot number of the most recent finalized block. The node then builds from the most recent finalized block by requesting for subsequent blocks by slot number. Once the service detects that the local chain is caught up with the network, the service hands over control to the regular sync service. Note: The behavior of initialsync will likely change as the specification changes. The most significant and highly probable change will be determining where to sync from. The beacon chain may sync from a block in the pasts X months in order to combat long-range attacks (see here: https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQs#what-is-weak-subjectivity)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SyncPollingInterval     time.Duration
	BlockBufferSize         int
	BlockAnnounceBufferSize int
	BatchedBlockBufferSize  int
	StateBufferSize         int
	BeaconDB                *db.BeaconDB
	P2P                     p2pAPI
	SyncService             syncService
	ChainService            chainService
}

Config defines the configurable properties of InitialSync.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig provides the default configuration for a sync service. SyncPollingInterval determines how frequently the service checks that initial sync is complete. BlockBufferSize determines that buffer size of the `blockBuf` channel. CrystallizedStateBufferSize determines the buffer size of thhe `crystallizedStateBuf` channel.

type InitialSync

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

InitialSync defines the main class in this package. See the package comments for a general description of the service's functions.

func NewInitialSyncService

func NewInitialSyncService(ctx context.Context,
	cfg *Config,
) *InitialSync

NewInitialSyncService constructs a new InitialSyncService. This method is normally called by the main node.

func (*InitialSync) Start

func (s *InitialSync) Start()

Start begins the goroutine.

func (*InitialSync) Stop

func (s *InitialSync) Stop() error

Stop kills the initial sync goroutine.

Jump to

Keyboard shortcuts

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