core

package
v0.0.0-...-4097cb8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrAddressUnauthorized is returned when given address cannot be found in
	// current validator set.
	ErrAddressUnauthorized = errors.New("unauthorized address")
	// ErrEngineStopped is returned if the engine is stopped
	ErrEngineStopped = errors.New("stopped engine")
	// ErrEngineStarted is returned if the engine is already started
	ErrEngineStarted = errors.New("started engine")
)

Functions

func Encode

func Encode(val interface{}) ([]byte, error)

func PrepareCommittedSeal

func PrepareCommittedSeal(hash common.Hash) []byte

PrepareCommittedSeal returns a committed seal for the given hash

Types

type Engine

type Engine interface {
	// begein to handle the roundchange/subscribeEvent/handleEvent
	Start() error
	// Stop the engine
	Stop() error
}

func NewCore

func NewCore(server bft.Server, config *bft.BFTConfig) Engine

NewCore initiate a new core

type State

type State uint64 // indicate state of
const (
	StateAcceptRequest State = iota
	StatePreprepared
	StatePrepared
	StateCommitted
)

func (State) Cmp

func (s State) Cmp(y State) int

Cmp compares s and y and returns:

-1 if s is the previous state of y
 0 if s and y are the same state
+1 if s is the next state of y

Jump to

Keyboard shortcuts

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