Documentation
¶
Overview ¶
Package devote implements the proof-of-authority consensus engine.
Package devote implements the proof-of-stake consensus engine.
Index ¶
- Variables
- func AccumulateRewards(govAddress common.Address, state *state.StateDB, header *types.Header, ...)
- func NextSlot(now uint64) uint64
- func PrevSlot(now uint64) uint64
- type API
- type Controller
- type Devote
- func (d *Devote) APIs(chain consensus.ChainReader) []rpc.API
- func (d *Devote) Author(header *types.Header) (common.Address, error)
- func (d *Devote) Authorize(signer string, signFn SignerFn)
- func (d *Devote) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (d *Devote) CheckWitness(lastBlock *types.Block, now int64) error
- func (c *Devote) Close() error
- func (d *Devote) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (d *Devote) GetGovernanceContractAddress(goveAddress GetGovernanceContractAddress)
- func (d *Devote) Masternodes(masternodeListFn MasternodeListFn)
- func (d *Devote) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (d *Devote) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (c *Devote) SealHash(header *types.Header) common.Hash
- func (d *Devote) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (d *Devote) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (d *Devote) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (d *Devote) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type GetGovernanceContractAddress
- type MasternodeListFn
- 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") ErrInvalidBlockWitness = errors.New("invalid block witness") ErrMinerFutureBlock = errors.New("miner the future block") ErrWaitForPrevBlock = errors.New("wait for last block arrived") ErrNilBlockHeader = errors.New("nil block header returned") ErrMismatchSignerAndWitness = errors.New("mismatch block signer and witness") ErrInvalidMinerBlockTime = errors.New("invalid time to miner the block") )
Functions ¶
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) GetWitnesses ¶
func (api *API) GetWitnesses(number *rpc.BlockNumber) ([]string, error)
GetWitnesses retrieves the list of the Witnesses at specified block
type Controller ¶
type Controller struct {
TimeStamp uint64
// contains filtered or unexported fields
}
func Newcontroller ¶
func Newcontroller(devoteDB *devotedb.DevoteDB) *Controller
type Devote ¶
type Devote struct {
// contains filtered or unexported fields
}
func (*Devote) APIs ¶
func (d *Devote) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs.
func (*Devote) Author ¶
Author implements consensus.Engine, returning the header's coinbase as the proof-of-stake verified author of the block.
func (*Devote) CalcDifficulty ¶
func (*Devote) CheckWitness ¶
func (*Devote) Close ¶
Close implements consensus.Engine. It's a noop for Devote as there is are no background threads.
func (*Devote) Finalize ¶
func (d *Devote) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, devoteDB *devotedb.DevoteDB) (*types.Block, error)
Finalize implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.
func (*Devote) GetGovernanceContractAddress ¶
func (d *Devote) GetGovernanceContractAddress(goveAddress GetGovernanceContractAddress)
func (*Devote) Masternodes ¶
func (d *Devote) Masternodes(masternodeListFn MasternodeListFn)
func (*Devote) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*Devote) Seal ¶
func (d *Devote) 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.
func (*Devote) VerifyHeader ¶
verifyHeader checks whether a header conforms to the consensus rules of the stock Etherzero devote engine.
func (*Devote) VerifyHeaders ¶
func (*Devote) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Devote) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.