circum

package
v0.0.0-...-11c7724 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package circum implements the proof-of-authority consensus engine.

Package circum implements the proof-of-stake consensus engine.

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

func AccumulateRewards

func AccumulateRewards(state *state.StateDB, header *types.Header)

AccumulateRewards credits the coinbase of the given block with the mining reward. The circum consensus allowed uncle block .

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

func (api *API) Test()

type Circum

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

func NewCircum

func NewCircum(config *params.CircumConfig, db ethdb.Database) *Circum

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

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

Author implements consensus.Engine, returning the header's coinbase as the proof-of-stake verified author of the block.

func (*Circum) Authorize

func (d *Circum) Authorize(signer string, signFn SignerFn)

func (*Circum) CalcDifficulty

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

func (*Circum) CheckWitness

func (d *Circum) CheckWitness(lastBlock *types.Block, now int64) error

func (*Circum) Close

func (d *Circum) Close() error

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

func (d *Circum) Prepare(chain consensus.ChainReader, header *types.Header) error

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

func (d *Circum) SealHash(header *types.Header) common.Hash

SealHash returns the hash of a block prior to it being sealed.

func (*Circum) VerifyHeader

func (d *Circum) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

verifyHeader checks whether a header conforms to the consensus rules of the stock circum engine.

func (*Circum) VerifyHeaders

func (d *Circum) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

func (*Circum) VerifySeal

func (d *Circum) 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 (*Circum) VerifyUncles

func (d *Circum) 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 MasternodeListFn

type MasternodeListFn func(number *big.Int) ([]string, error)

type SignerFn

type SignerFn func(string, []byte) ([]byte, error)

SignerFn string:master node nodeid,[8]byte []byte,signature

Jump to

Keyboard shortcuts

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