Documentation ¶
Index ¶
- Variables
- func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, ...)
- func NextSlot(now int64, blockInterval uint64) int64
- func PrevSlot(now int64, blockInterval uint64) int64
- type API
- type Dpos
- func (d *Dpos) APIs(chain consensus.ChainReader) []rpc.API
- func (d *Dpos) Author(header *types.Header) (common.Address, error)
- func (d *Dpos) Authorize(signer common.Address, signFn SignerFn)
- func (d *Dpos) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (d *Dpos) CheckValidator(lastBlock *types.Block, now int64, blockInterval uint64) error
- func (d *Dpos) Close() error
- func (d *Dpos) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (d *Dpos) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (d *Dpos) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (d *Dpos) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool, ...) error
- func (d *Dpos) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (d *Dpos) VerifySeal(chain consensus.ChainReader, currentheader, genesisheader *types.Header) error
- func (d *Dpos) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type EpochContext
- type SignerFn
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidTimestamp is returned if the timestamp of a block is lower than // the previous block's timestamp + the minimum block period. ErrInvalidTimestamp = errors.New("invalid timestamp") ErrWaitForPrevBlock = errors.New("wait for last block arrived") ErrMintFutureBlock = errors.New("mint the future block") ErrMismatchSignerAndValidator = errors.New("mismatch block signer and validator") ErrInvalidBlockValidator = errors.New("invalid block validator") ErrInvalidMintBlockTime = errors.New("invalid time to mint the block") ErrNilBlockHeader = errors.New("nil block header returned") )
Functions ¶
func AccumulateRewards ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to allow controlling the delegate and voting mechanisms of the delegated-proof-of-stake
func (*API) GetConfirmedBlockNumber ¶
GetConfirmedBlockNumber retrieves the latest irreversible block
func (*API) GetValidators ¶
GetValidators retrieves the list of the validators at specified block
type Dpos ¶
type Dpos struct {
// contains filtered or unexported fields
}
func (*Dpos) CalcDifficulty ¶
func (*Dpos) CheckValidator ¶
检查当前的验证人是否在当前的节点上
func (*Dpos) Finalize ¶
func (d *Dpos) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, dposContext *types.DposContext) (*types.Block, error)
将出块周期内的交易打包进新的区块中
func (*Dpos) Seal ¶
func (d *Dpos) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
Seal generates a new block for the given input block with the local miner's seal place on top. 验证块内容是否符合dposS算法规则(验证新块是否是应该由该验证人来出块)
func (*Dpos) VerifyHeader ¶
func (d *Dpos) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool, blockInterval uint64) error
Verify that the bulk complies with the consensus algorithm rules
func (*Dpos) VerifyHeaders ¶
func (d *Dpos) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
批量验证区块头是否符合共识算法规则
func (*Dpos) VerifySeal ¶
func (d *Dpos) VerifySeal(chain consensus.ChainReader, currentheader, genesisheader *types.Header) error
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Dpos) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.
type EpochContext ¶
type EpochContext struct { TimeStamp int64 DposContext *types.DposContext // contains filtered or unexported fields }