Documentation ¶
Index ¶
- Constants
- type Config
- type Opinion
- type ThreadSafeVerifyingTortoise
- func (trtl *ThreadSafeVerifyingTortoise) BaseBlock(ctx context.Context) (types.BlockID, [][]types.BlockID, error)
- func (trtl *ThreadSafeVerifyingTortoise) HandleIncomingLayer(ctx context.Context, layerID types.LayerID) (oldVerified, newVerified types.LayerID, reverted bool)
- func (trtl *ThreadSafeVerifyingTortoise) HandleLateBlocks(ctx context.Context, blocks []*types.Block) (types.LayerID, types.LayerID)
- func (trtl *ThreadSafeVerifyingTortoise) LatestComplete() types.LayerID
- func (trtl *ThreadSafeVerifyingTortoise) Persist(ctx context.Context) error
Constants ¶
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "consensus" )
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 ATXDB atxDataProvider Clock layerClock 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 }
Config holds the arguments and dependencies to create a verifying tortoise instance.
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 ¶
func (trtl *ThreadSafeVerifyingTortoise) BaseBlock(ctx context.Context) (types.BlockID, [][]types.BlockID, error)
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) (oldVerified, newVerified types.LayerID, reverted 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) HandleLateBlocks ¶
func (trtl *ThreadSafeVerifyingTortoise) HandleLateBlocks(ctx context.Context, blocks []*types.Block) (types.LayerID, types.LayerID)
HandleLateBlocks processes votes and goodness for late blocks (for late block definition see white paper). 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