Documentation ¶
Index ¶
- func CombineMsg(msgType uint32, msgBody []byte) proto.Message
- func SeparateMsg(m proto.Message) (uint32, []byte)
- type Consensus
- type IotxConsensus
- func (c *IotxConsensus) HandleBlockPropose(m proto.Message, done chan bool) error
- func (c *IotxConsensus) HandleViewChange(m proto.Message, done chan bool) error
- func (c *IotxConsensus) Metrics() (scheme.ConsensusMetrics, error)
- func (c *IotxConsensus) Scheme() scheme.Scheme
- func (c *IotxConsensus) Start() error
- func (c *IotxConsensus) Stop() error
- type Sim
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineMsg ¶ added in v0.2.0
CombineMsg combines a msgType and msgBody into a single proto.Message
Types ¶
type Consensus ¶
type Consensus interface { Start() error Stop() error HandleViewChange(proto.Message, chan bool) error HandleBlockPropose(proto.Message, chan bool) error 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, bs blocksync.BlockSync, dlg delegate.Pool, sf state.Factory, ) Consensus
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) HandleBlockPropose ¶ added in v0.2.0
func (c *IotxConsensus) HandleBlockPropose(m proto.Message, done chan bool) error
HandleBlockPropose handles a proposed block
func (*IotxConsensus) HandleViewChange ¶ added in v0.2.0
func (c *IotxConsensus) HandleViewChange(m proto.Message, done chan bool) error
HandleViewChange dispatches the call to different schemes
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() error
Start starts running the consensus algorithm
func (*IotxConsensus) Stop ¶ added in v0.2.0
func (c *IotxConsensus) Stop() error
Stop stops running the consensus algorithm
type Sim ¶ added in v0.2.0
type Sim interface { Start() error Stop() error HandleViewChange(proto.Message, chan bool) error HandleBlockPropose(proto.Message, chan bool) error SetStream(*pbsim.Simulator_PingServer) SetDoneStream(chan bool) SendUnsent() }
Sim is the interface for handling IotxConsensus view change used in the simulator
func NewSim ¶ added in v0.2.0
func NewSim( cfg *config.Config, bc blockchain.Blockchain, bs blocksync.BlockSync, dlg delegate.Pool, sf state.Factory, ) Sim
NewSim creates a consensus_sim struct
func NewSimByzantine ¶ added in v0.2.0
func NewSimByzantine( cfg *config.Config, bc blockchain.Blockchain, bs blocksync.BlockSync, dlg delegate.Pool, sf state.Factory, ) Sim
NewSimByzantine creates a byzantine consensus_sim struct