package blocksync

import "go.dedis.ch/dela/core/ordering/cosipbft/blocksync"

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

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.

Source Files

blocksync.go default.go

Directories

PathSynopsis
core/ordering/cosipbft/blocksync/json
core/ordering/cosipbft/blocksync/typesPackage types implements the network messages for a synchronization.
Version
v0.1.0 (latest)
Published
Apr 10, 2024
Platform
linux/amd64
Imports
13 packages
Last checked
1 month ago

Tools for package owners.