Documentation ¶
Index ¶
- func GetAddr(cfg config.Config) (keypair.PublicKey, keypair.PrivateKey, string)
- type Consensus
- type IotxConsensus
- func (c *IotxConsensus) Calibrate(height uint64)
- func (c *IotxConsensus) HandleConsensusMsg(propose *iproto.ConsensusPb) error
- func (c *IotxConsensus) Metrics() (scheme.ConsensusMetrics, error)
- func (c *IotxConsensus) Scheme() scheme.Scheme
- func (c *IotxConsensus) Start(ctx context.Context) error
- func (c *IotxConsensus) Stop(ctx context.Context) error
- func (c *IotxConsensus) ValidateBlockFooter(blk *block.Block) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Consensus ¶
type Consensus interface { lifecycle.StartStopper HandleConsensusMsg(*iproto.ConsensusPb) error Calibrate(uint64) Metrics() (scheme.ConsensusMetrics, error) }
Consensus is the interface for handling IotxConsensus view change.
func NewConsensus ¶
func NewConsensus( cfg config.Config, bc blockchain.Blockchain, ap actpool.ActPool, opts ...Option, ) (Consensus, error)
NewConsensus creates a IotxConsensus struct.
type IotxConsensus ¶ added in v0.2.0
type IotxConsensus struct {
// contains filtered or unexported fields
}
IotxConsensus implements Consensus
func (*IotxConsensus) Calibrate ¶ added in v0.4.4
func (c *IotxConsensus) Calibrate(height uint64)
Calibrate triggers an event to calibrate consensus context
func (*IotxConsensus) HandleConsensusMsg ¶ added in v0.4.4
func (c *IotxConsensus) HandleConsensusMsg(propose *iproto.ConsensusPb) error
HandleConsensusMsg handles consensus messages
func (*IotxConsensus) Metrics ¶ added in v0.2.0
func (c *IotxConsensus) Metrics() (scheme.ConsensusMetrics, error)
Metrics returns consensus metrics
func (*IotxConsensus) Scheme ¶ added in v0.2.0
func (c *IotxConsensus) Scheme() scheme.Scheme
Scheme returns the scheme instance
func (*IotxConsensus) Start ¶ added in v0.2.0
func (c *IotxConsensus) Start(ctx context.Context) error
Start starts running the consensus algorithm
func (*IotxConsensus) Stop ¶ added in v0.2.0
func (c *IotxConsensus) Stop(ctx context.Context) error
Stop stops running the consensus algorithm
func (*IotxConsensus) ValidateBlockFooter ¶ added in v0.4.4
func (c *IotxConsensus) ValidateBlockFooter(blk *block.Block) error
ValidateBlockFooter validates the signatures in block footer
type Option ¶ added in v0.4.0
type Option func(op *optionParams) error
Option sets Consensus construction parameter.
func WithBroadcast ¶ added in v0.4.4
WithBroadcast is an option to add broadcast callback to Consensus
func WithRootChainAPI ¶ added in v0.4.0
func WithRootChainAPI(exp explorerapi.Explorer) Option
WithRootChainAPI is an option to add a root chain api to Consensus.