dpos

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2019 License: GPL-3.0, GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header)

func NextSlot

func NextSlot(now int64) int64

func PrevSlot

func PrevSlot(now int64) int64

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

func (api *API) GetConfirmedBlockNumber() (*big.Int, error)

GetConfirmedBlockNumber retrieves the latest irreversible block

func (*API) GetValidators

func (api *API) GetValidators(number *rpc.BlockNumber) ([]common.Address, error)

GetValidators retrieves the list of the validators at specified block

type Dpos

type Dpos struct {
	// contains filtered or unexported fields
}

func New

func New(config *params.DposConfig, db ctxcdb.Database) *Dpos

func (*Dpos) APIs

func (d *Dpos) APIs(chain consensus.ChainReader) []rpc.API

func (*Dpos) Author

func (d *Dpos) Author(header *types.Header) (common.Address, error)

func (*Dpos) Authorize

func (d *Dpos) Authorize(signer common.Address, signFn SignerFn)

func (*Dpos) CalcDifficulty

func (d *Dpos) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int

func (*Dpos) CheckValidator

func (d *Dpos) CheckValidator(lastBlock *types.Block, now int64) error

func (*Dpos) Coinbase

func (d *Dpos) Coinbase(header *types.Header) (common.Address, error)

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) Prepare

func (d *Dpos) Prepare(chain consensus.ChainReader, header *types.Header) 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.

func (*Dpos) VerifyHeader

func (d *Dpos) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) 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, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.

func (*Dpos) VerifyUncles

func (d *Dpos) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

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
}

type SignerFn

type SignerFn func(accounts.Account, []byte) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL