blocksync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package blocksync defines a block synchronizer for the ordering service.

The package also implements a default synchronizer that will send an announcement with the latest known block, and share the chain to the nodes that have fallen behind.

Documentation Last Review: 13.10.2020

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MinSoft is the number of participants that have soft-synchronized,
	// meaning they know the latest index of the leader.
	MinSoft int

	// MinHard is the number of participants that have hard-synchronized,
	// meaning they have the latest block stored.
	MinHard int
}

Config is the configuration to change the behaviour of the synchronization.

type SyncParam

type SyncParam struct {
	Mino            mino.Mino
	PBFT            pbft.StateMachine
	Blocks          blockstore.BlockStore
	Genesis         blockstore.GenesisStore
	LinkFactory     otypes.LinkFactory
	ChainFactory    otypes.ChainFactory
	VerifierFactory crypto.VerifierFactory
}

SyncParam is the parameter object to create a new synchronizer.

type Synchronizer

type Synchronizer interface {
	// GetLatest returns the latest known synchronization update. It can be used
	// to wait for a complete chain update as this index has been proven to
	// exist.
	GetLatest() uint64

	// Sync sends a synchronization message to all the participants in order to
	// announce the current state of the chain.
	Sync(ctx context.Context, players mino.Players, cfg Config) error
}

Synchronizer is an interface to synchronize a leader with the participants.

func NewSynchronizer

func NewSynchronizer(param SyncParam) Synchronizer

NewSynchronizer creates a new block synchronizer.

Directories

Path Synopsis
Package types implements the network messages for a synchronization.
Package types implements the network messages for a synchronization.

Jump to

Keyboard shortcuts

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