rolldpos

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.10.0

type Option func(*Protocol) error

Option is optional setting for epoch protocol

func EnableDardanellesSubEpoch added in v0.10.0

func EnableDardanellesSubEpoch(height, numSubEpochs uint64) Option

EnableDardanellesSubEpoch will set give numSubEpochs at give height.

type Protocol

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

Protocol defines an epoch protocol

func FindProtocol added in v0.11.0

func FindProtocol(registry *protocol.Registry) *Protocol

FindProtocol return a registered protocol from registry

func MustGetProtocol added in v0.11.0

func MustGetProtocol(registry *protocol.Registry) *Protocol

MustGetProtocol return a registered protocol from registry

func NewProtocol

func NewProtocol(numCandidateDelegates, numDelegates, numSubEpochs uint64, opts ...Option) *Protocol

NewProtocol returns a new rolldpos protocol

func (*Protocol) ForceRegister added in v0.11.0

func (p *Protocol) ForceRegister(r *protocol.Registry) error

ForceRegister registers the protocol with a unique ID and force replacing the previous protocol if it exists

func (*Protocol) GetEpochHeight

func (p *Protocol) GetEpochHeight(epochNum uint64) uint64

GetEpochHeight returns the start height of an epoch

func (*Protocol) GetEpochLastBlockHeight

func (p *Protocol) GetEpochLastBlockHeight(epochNum uint64) uint64

GetEpochLastBlockHeight returns the last height of an epoch

func (*Protocol) GetEpochNum

func (p *Protocol) GetEpochNum(height uint64) uint64

GetEpochNum returns the number of the epoch for a given height

func (*Protocol) GetSubEpochNum

func (p *Protocol) GetSubEpochNum(height uint64) uint64

GetSubEpochNum returns the sub epoch number of a block height

func (*Protocol) Handle

Handle handles a modification

func (*Protocol) Name added in v1.0.0

func (p *Protocol) Name() string

Name returns the name of protocol

func (*Protocol) NumCandidateDelegates

func (p *Protocol) NumCandidateDelegates() uint64

NumCandidateDelegates returns the number of delegate candidates for an epoch

func (*Protocol) NumDelegates

func (p *Protocol) NumDelegates() uint64

NumDelegates returns the number of delegates in an epoch

func (*Protocol) NumSubEpochs

func (p *Protocol) NumSubEpochs(height uint64) uint64

NumSubEpochs returns the number of subEpochs given a block height

func (*Protocol) ProductivityByEpoch added in v1.0.0

func (p *Protocol) ProductivityByEpoch(
	epochNum uint64,
	tipHeight uint64,
	productivity func(uint64, uint64) (map[string]uint64, error),
) (uint64, map[string]uint64, error)

ProductivityByEpoch read the productivity in an epoch

func (*Protocol) ReadState

func (p *Protocol) ReadState(ctx context.Context, _ protocol.StateReader, method []byte, args ...[]byte) ([]byte, error)

ReadState read the state on blockchain via protocol

func (*Protocol) Register added in v0.11.0

func (p *Protocol) Register(r *protocol.Registry) error

Register registers the protocol with a unique ID

Jump to

Keyboard shortcuts

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