Documentation ¶
Index ¶
- func GetConstructor(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, ...) consensus.Constructor
- func GetName() string
- func ValidateGenesis(genesis *types.Genesis) error
- type SimpleBlockFactory
- func (s *SimpleBlockFactory) BlockFactory() consensus.BlockFactory
- func (s *SimpleBlockFactory) ClusterInfo(bestBlockHash []byte) *types.GetClusterInfoResponse
- func (s *SimpleBlockFactory) ConfChange(req *types.MembershipChange) (*consensus.Member, error)
- func (s *SimpleBlockFactory) ConfChangeInfo(requestID uint64) (*types.ConfChangeProgress, error)
- func (s *SimpleBlockFactory) ConsensusInfo() *types.ConsensusInfo
- func (s *SimpleBlockFactory) GetType() consensus.ConsensusType
- func (s *SimpleBlockFactory) HasWAL() bool
- func (s *SimpleBlockFactory) Info() string
- func (s *SimpleBlockFactory) IsBlockValid(*types.Block, *types.Block) error
- func (s *SimpleBlockFactory) IsConnectedBlock(block *types.Block) bool
- func (s *SimpleBlockFactory) IsForkEnable() bool
- func (s *SimpleBlockFactory) IsTransactionValid(tx *types.Tx) bool
- func (s *SimpleBlockFactory) JobQueue() chan<- interface{}
- func (s *SimpleBlockFactory) MakeConfChangeProposal(req *types.MembershipChange) (*consensus.ConfChangePropose, error)
- func (s *SimpleBlockFactory) NeedNotify() bool
- func (s *SimpleBlockFactory) NeedReorganization(rootNo types.BlockNo) bool
- func (s *SimpleBlockFactory) QueueJob(now time.Time, jq chan<- interface{})
- func (s *SimpleBlockFactory) QuitChan() chan interface{}
- func (s *SimpleBlockFactory) RaftAccessor() consensus.AergoRaftAccessor
- func (s *SimpleBlockFactory) Save(tx consensus.TxWriter) error
- func (s *SimpleBlockFactory) Start()
- func (s *SimpleBlockFactory) Ticker() *time.Ticker
- func (s *SimpleBlockFactory) Update(block *types.Block)
- func (s *SimpleBlockFactory) VerifySign(*types.Block) error
- func (s *SimpleBlockFactory) VerifyTimestamp(*types.Block) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConstructor ¶
func GetConstructor(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, sdb *state.ChainStateDB) consensus.Constructor
GetConstructor build and returns consensus.Constructor from New function.
func ValidateGenesis ¶
Types ¶
type SimpleBlockFactory ¶
type SimpleBlockFactory struct { *component.ComponentHub consensus.ChainDB // contains filtered or unexported fields }
SimpleBlockFactory implments a simple block factory which generate block each cfg.Consensus.BlockInterval.
This can be used for testing purpose.
func New ¶
func New( bv types.BlockVersionner, hub *component.ComponentHub, cdb consensus.ChainDB, sdb *state.ChainStateDB, ) (*SimpleBlockFactory, error)
New returns a SimpleBlockFactory.
func (*SimpleBlockFactory) BlockFactory ¶
func (s *SimpleBlockFactory) BlockFactory() consensus.BlockFactory
BlockFactory returns s itself.
func (*SimpleBlockFactory) ClusterInfo ¶
func (s *SimpleBlockFactory) ClusterInfo(bestBlockHash []byte) *types.GetClusterInfoResponse
func (*SimpleBlockFactory) ConfChange ¶
func (s *SimpleBlockFactory) ConfChange(req *types.MembershipChange) (*consensus.Member, error)
func (*SimpleBlockFactory) ConfChangeInfo ¶
func (s *SimpleBlockFactory) ConfChangeInfo(requestID uint64) (*types.ConfChangeProgress, error)
func (*SimpleBlockFactory) ConsensusInfo ¶
func (s *SimpleBlockFactory) ConsensusInfo() *types.ConsensusInfo
func (*SimpleBlockFactory) GetType ¶
func (s *SimpleBlockFactory) GetType() consensus.ConsensusType
func (*SimpleBlockFactory) HasWAL ¶
func (s *SimpleBlockFactory) HasWAL() bool
func (*SimpleBlockFactory) Info ¶
func (s *SimpleBlockFactory) Info() string
Info retuns an empty string since SBP has no valuable consensus-related information.
func (*SimpleBlockFactory) IsBlockValid ¶
IsBlockValid checks the consensus level validity of a block.
func (*SimpleBlockFactory) IsConnectedBlock ¶
func (s *SimpleBlockFactory) IsConnectedBlock(block *types.Block) bool
func (*SimpleBlockFactory) IsForkEnable ¶
func (s *SimpleBlockFactory) IsForkEnable() bool
func (*SimpleBlockFactory) IsTransactionValid ¶
func (s *SimpleBlockFactory) IsTransactionValid(tx *types.Tx) bool
IsTransactionValid checks the onsensus level validity of a transaction
func (*SimpleBlockFactory) JobQueue ¶
func (s *SimpleBlockFactory) JobQueue() chan<- interface{}
JobQueue returns the queue for block production triggering.
func (*SimpleBlockFactory) MakeConfChangeProposal ¶
func (s *SimpleBlockFactory) MakeConfChangeProposal(req *types.MembershipChange) (*consensus.ConfChangePropose, error)
func (*SimpleBlockFactory) NeedNotify ¶
func (s *SimpleBlockFactory) NeedNotify() bool
func (*SimpleBlockFactory) NeedReorganization ¶
func (s *SimpleBlockFactory) NeedReorganization(rootNo types.BlockNo) bool
NeedReorganization has nothing to do.
func (*SimpleBlockFactory) QueueJob ¶
func (s *SimpleBlockFactory) QueueJob(now time.Time, jq chan<- interface{})
QueueJob send a block triggering information to jq.
func (*SimpleBlockFactory) QuitChan ¶
func (s *SimpleBlockFactory) QuitChan() chan interface{}
QuitChan returns the channel from which consensus-related goroutines check when shutdown is initiated.
func (*SimpleBlockFactory) RaftAccessor ¶
func (s *SimpleBlockFactory) RaftAccessor() consensus.AergoRaftAccessor
func (*SimpleBlockFactory) Save ¶
func (s *SimpleBlockFactory) Save(tx consensus.TxWriter) error
Save has nothging to do.
func (*SimpleBlockFactory) Start ¶
func (s *SimpleBlockFactory) Start()
Start run a simple block factory service.
func (*SimpleBlockFactory) Ticker ¶
func (s *SimpleBlockFactory) Ticker() *time.Ticker
Ticker returns a time.Ticker for the main consensus loop.
func (*SimpleBlockFactory) Update ¶
func (s *SimpleBlockFactory) Update(block *types.Block)
Update has nothging to do.
func (*SimpleBlockFactory) VerifySign ¶
func (s *SimpleBlockFactory) VerifySign(*types.Block) error
VerifySign checks the consensus level validity of a block.
func (*SimpleBlockFactory) VerifyTimestamp ¶
func (s *SimpleBlockFactory) VerifyTimestamp(*types.Block) bool
VerifyTimestamp checks the validity of the block timestamp.