Documentation ¶
Overview ¶
Package circum implements the proof-of-authority consensus engine.
Package circum implements the proof-of-stake consensus engine.
Index ¶
- Variables
- func AccumulateRewards(state *state.StateDB, header *types.Header)
- type API
- type Circum
- func (d *Circum) APIs(chain consensus.ChainReader) []rpc.API
- func (d *Circum) Author(header *types.Header) (common.Address, error)
- func (d *Circum) Authorize(signer string, signFn SignerFn)
- func (d *Circum) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (d *Circum) CheckWitness(lastBlock *types.Block, now int64) error
- func (d *Circum) Close() error
- func (d *Circum) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (d *Circum) Masternodes(masternodeListFn MasternodeListFn)
- func (d *Circum) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (d *Circum) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (d *Circum) SealHash(header *types.Header) common.Hash
- func (d *Circum) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (d *Circum) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (d *Circum) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (d *Circum) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- 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") ErrWaitForRightTime = errors.New("wait for right time") 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
type Circum ¶
type Circum struct {
// contains filtered or unexported fields
}
func (*Circum) APIs ¶
func (d *Circum) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs.
func (*Circum) Author ¶
Author implements consensus.Engine, returning the header's coinbase as the proof-of-stake verified author of the block.
func (*Circum) CalcDifficulty ¶
func (*Circum) CheckWitness ¶
func (*Circum) Close ¶
Close implements consensus.Engine. It's a noop for Circum as there is are no background threads.
func (*Circum) Finalize ¶
func (d *Circum) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
Finalize implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.
func (*Circum) Masternodes ¶
func (d *Circum) Masternodes(masternodeListFn MasternodeListFn)
func (*Circum) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*Circum) Seal ¶
func (d *Circum) 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 (*Circum) VerifyHeader ¶
verifyHeader checks whether a header conforms to the consensus rules of the stock circum engine.
func (*Circum) VerifyHeaders ¶
func (*Circum) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Circum) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.