Documentation ¶
Overview ¶
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
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 //上一个块的时间戳+最小块周期。 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是面向用户的RPC API,允许控制委托和投票 委托股权证明机制
func (*API) GetConfirmedBlockNumber ¶
getconfirmedBlockNumber检索最新的不可逆块
func (*API) GetValidators ¶
getvalidators检索指定块上的验证程序列表
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使用本地矿工的 密封顶部。 验证模块内容是否符合DPOSS计算法规(验证新模块是否应由该验证人员提出模块)
func (*Dpos) VerifyHeader ¶
func (d *Dpos) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool, blockInterval uint64) error
验证批量是否符合共识算法规则
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
验证seal是否执行consension.engine,检查签名是否包含 头部满足共识协议要求。
func (*Dpos) VerifyUncles ¶
verifyuncles实现converse.engine,始终返回任何 因为这个共识机制不允许叔叔。
type EpochContext ¶
type EpochContext struct { TimeStamp int64 DposContext *types.DposContext // contains filtered or unexported fields }