rolldpos

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidViewChangeMsg is the error that ViewChangeMsg is invalid
	ErrInvalidViewChangeMsg = errors.New("ViewChangeMsg is invalid")
)

Functions

func FixedProposer

func FixedProposer(delegates []net.Addr, _ []byte, _ uint64, _ uint64) (net.Addr, error)

FixedProposer will always choose the first in the delegate list as the proposer

func GeneratePseudoDKG

func GeneratePseudoDKG() (common.DKGHash, error)

GeneratePseudoDKG generates a pseudo DKG bytes

func NeverStartNewEpoch

func NeverStartNewEpoch(_ net.Addr, _ uint64, _ state.Factory, _ delegate.Pool) (bool, error)

NeverStartNewEpoch will never allow to start a new epochStart after the first one

func PseudoRotatedProposer

func PseudoRotatedProposer(delegates []net.Addr, _ []byte, _ uint64, height uint64) (net.Addr, error)

PseudoRotatedProposer will rotate among the delegates to choose the proposer

func PseudoStarNewEpoch

func PseudoStarNewEpoch(_ net.Addr, _ uint64, _ state.Factory, _ delegate.Pool) (bool, error)

PseudoStarNewEpoch will always allow to start a new epochStart after the first one

func PseudoStartRollingEpoch

func PseudoStartRollingEpoch(self net.Addr, epochNum uint64, _ state.Factory, pool delegate.Pool) (bool, error)

PseudoStartRollingEpoch will only allows the delegates chosen for given epoch to enter the epoch

Types

type DNet

type DNet interface {
	Tell(node net.Addr, msg proto.Message) error
	Self() net.Addr
	Broadcast(msg proto.Message) error
}

DNet is the delegate networks interface.

type RollDPoS

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

RollDPoS is the RollDPoS consensus scheme

func NewRollDPoS

NewRollDPoS creates a RollDPoS struct

func (*RollDPoS) EventChan

func (n *RollDPoS) EventChan() *chan *fsm.Event

EventChan returns the event chan

func (*RollDPoS) FSM

func (n *RollDPoS) FSM() *fsm.Machine

FSM returns the FSM instance

func (*RollDPoS) Handle

func (n *RollDPoS) Handle(m proto.Message) error

Handle handles incoming messages and publish to the channel.

func (*RollDPoS) Metrics

func (n *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)

Metrics returns the roll dpos metrics

func (*RollDPoS) SetDoneStream

func (n *RollDPoS) SetDoneStream(done chan bool)

SetDoneStream sets a boolean channel which indicates to the simulator that the consensus is done

func (*RollDPoS) Start

func (n *RollDPoS) Start() error

Start initialize the RollDPoS and roundStart to consume requests from request channel.

func (*RollDPoS) Stop

func (n *RollDPoS) Stop() error

Stop stops the RollDPoS and stop consuming requests from request channel.

Jump to

Keyboard shortcuts

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