tortoise

package
v0.2.6-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	LayerSize                uint32
	Database                 database.Database
	MeshDatabase             blockDataProvider
	Beacons                  blocks.BeaconGetter
	ATXDB                    atxDataProvider
	Hdist                    uint32   // hare lookback distance: the distance over which we use the input vector/hare results
	Zdist                    uint32   // hare result wait distance: the distance over which we're willing to wait for hare results
	ConfidenceParam          uint32   // confidence wait distance: how long we wait for global consensus to be established
	GlobalThreshold          *big.Rat // threshold required to finalize blocks and layers
	LocalThreshold           *big.Rat // threshold that determines whether a node votes based on local or global opinion
	WindowSize               uint32   // tortoise sliding window: how many layers we store data for
	Log                      log.Log
	RerunInterval            time.Duration // how often to rerun from genesis
	BadBeaconVoteDelayLayers uint32        // number of layers to delay votes for blocks with bad beacon values during self-healing
}

Config holds the arguments and dependencies to create a verifying tortoise instance.

type Opinion

type Opinion map[types.BlockID]vec

Opinion is opinions on other blocks.

type ThreadSafeVerifyingTortoise

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

ThreadSafeVerifyingTortoise is a thread safe verifying tortoise wrapper, it just locks all actions.

func NewVerifyingTortoise

func NewVerifyingTortoise(ctx context.Context, cfg Config) *ThreadSafeVerifyingTortoise

NewVerifyingTortoise creates ThreadSafeVerifyingTortoise instance.

func (*ThreadSafeVerifyingTortoise) BaseBlock

BaseBlock chooses a base block and creates a differences list. needs the hare results for latest layers.

func (*ThreadSafeVerifyingTortoise) HandleIncomingLayer

func (trtl *ThreadSafeVerifyingTortoise) HandleIncomingLayer(ctx context.Context, layerID types.LayerID) (types.LayerID, types.LayerID, bool)

HandleIncomingLayer processes all layer block votes returns the old verified layer and new verified layer after taking into account the blocks votes.

func (*ThreadSafeVerifyingTortoise) LatestComplete

func (trtl *ThreadSafeVerifyingTortoise) LatestComplete() types.LayerID

LatestComplete returns the latest verified layer.

func (*ThreadSafeVerifyingTortoise) Persist

func (trtl *ThreadSafeVerifyingTortoise) Persist(ctx context.Context) error

Persist saves a copy of the current tortoise state to the database.

func (*ThreadSafeVerifyingTortoise) Stop

func (trtl *ThreadSafeVerifyingTortoise) Stop()

Stop background workers.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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