Documentation ¶
Index ¶
- Variables
- func NewSingleConsensus(cctx base.ConsensusCtx, ccfg base.ConsensusConfig) base.CommonConsensus
- type SingleConfig
- type SingleConsensus
- func (s *SingleConsensus) CalculateBlock(block ledger.BlockHandle) error
- func (s *SingleConsensus) CheckMinerMatch(ctx xctx.Context, block ledger.BlockHandle) (bool, error)
- func (s *SingleConsensus) CompeteMaster(height int64) (bool, bool, error)
- func (s *SingleConsensus) GetConsensusStatus() (base.ConsensusStatus, error)
- func (s *SingleConsensus) ParseConsensusStorage(block ledger.BlockHandle) (interface{}, error)
- func (s *SingleConsensus) ProcessBeforeMiner(height, timestamp int64) ([]byte, []byte, error)
- func (s *SingleConsensus) ProcessConfirmBlock(block ledger.BlockHandle) error
- func (s *SingleConsensus) Start() error
- func (s *SingleConsensus) Stop() error
- type SingleStatus
- type ValidatorsInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MinerAddressErr = errors.New("Block's proposer must be equal to its address.")
)
Functions ¶
func NewSingleConsensus ¶
func NewSingleConsensus(cctx base.ConsensusCtx, ccfg base.ConsensusConfig) base.CommonConsensus
NewSingleConsensus 初始化实例
Types ¶
type SingleConfig ¶
type SingleConsensus ¶
type SingleConsensus struct {
// contains filtered or unexported fields
}
SingleConsensus 单点出块的共识逻辑
func (*SingleConsensus) CalculateBlock ¶
func (s *SingleConsensus) CalculateBlock(block ledger.BlockHandle) error
func (*SingleConsensus) CheckMinerMatch ¶
func (s *SingleConsensus) CheckMinerMatch(ctx xctx.Context, block ledger.BlockHandle) (bool, error)
func (*SingleConsensus) CompeteMaster ¶
func (s *SingleConsensus) CompeteMaster(height int64) (bool, bool, error)
func (*SingleConsensus) GetConsensusStatus ¶
func (s *SingleConsensus) GetConsensusStatus() (base.ConsensusStatus, error)
GetStatus 获取区块链共识信息
func (*SingleConsensus) ParseConsensusStorage ¶
func (s *SingleConsensus) ParseConsensusStorage(block ledger.BlockHandle) (interface{}, error)
func (*SingleConsensus) ProcessBeforeMiner ¶
func (s *SingleConsensus) ProcessBeforeMiner(height, timestamp int64) ([]byte, []byte, error)
ProcessBeforeMiner 开始挖矿前进行相应的处理, Single共识返回空
func (*SingleConsensus) ProcessConfirmBlock ¶
func (s *SingleConsensus) ProcessConfirmBlock(block ledger.BlockHandle) error
func (*SingleConsensus) Start ¶
func (s *SingleConsensus) Start() error
func (*SingleConsensus) Stop ¶
func (s *SingleConsensus) Stop() error
type SingleStatus ¶
type SingleStatus struct {
// contains filtered or unexported fields
}
func (*SingleStatus) GetConsensusBeginInfo ¶
func (s *SingleStatus) GetConsensusBeginInfo() int64
func (*SingleStatus) GetConsensusName ¶
func (s *SingleStatus) GetConsensusName() string
func (*SingleStatus) GetCurrentTerm ¶
func (s *SingleStatus) GetCurrentTerm() int64
func (*SingleStatus) GetCurrentValidatorsInfo ¶
func (s *SingleStatus) GetCurrentValidatorsInfo() []byte
func (*SingleStatus) GetStepConsensusIndex ¶
func (s *SingleStatus) GetStepConsensusIndex() int
func (*SingleStatus) GetVersion ¶
func (s *SingleStatus) GetVersion() int64
type ValidatorsInfo ¶
type ValidatorsInfo struct {
Validators []string `json:"validators"`
}
Click to show internal directories.
Click to hide internal directories.