dpovp

package
v0.0.0-...-64d6040 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: GPL-3.0 Imports: 15 Imported by: 4

Documentation

Overview

implements for Dpovp consensus

Index

Constants

This section is empty.

Variables

View Source
var (
	BlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
)

Functions

This section is empty.

Types

type Dpovp

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

func New

func New(config *params.DpovpConfig, db lovedb.Database, coinbase common.Address) *Dpovp

新增一个DPOVP共识机

func NewFakeDelayer

func NewFakeDelayer(delay time.Duration) *Dpovp

NewFakeDelayer creates a dpovp consensus engine with a fake DPoVP scheme that accepts all blocks as valid, but delays verifications by some time, though they still have to conform to the LoveBlock consensus rules.

func NewFakeFailer

func NewFakeFailer(fail uint64) *Dpovp

NewFakeFailer creates a dpovp consensus engine with a fake DPoVP scheme that accepts all blocks as valid apart from the single one specified, though they still have to conform to the LoveBlock consensus rules.

func NewFaker

func NewFaker() *Dpovp

NewFaker creates a dpovp consensus engine with a fake DPoVP scheme that accepts all blocks' seal as valid, though they still have to conform to the LoveBlock consensus rules.

func NewFullFaker

func NewFullFaker() *Dpovp

NewFullFaker creates an dpovp consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.

func NewShared

func NewShared() *Dpovp

NewShared creates a full sized DPoVP shared between all requesters running in the same process.

func NewTester

func NewTester() *Dpovp

NewTester creates a small sized DPoVP scheme useful only for testing purposes.

func (*Dpovp) APIs

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

APIs returns the RPC APIs this consensus engine provides.

func (*Dpovp) Author

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

Author implements consensus.Engine, returning the LoveBlock address recovered from the signature in the header's extra-data section. Author implements consensus.Engine, returning the header's coinbase as the proof-of-work verified author of the block.

func (*Dpovp) CalcDifficulty

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

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have.

func (*Dpovp) Finalize

func (d *Dpovp) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
	uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize runs any post-transaction state modifications (e.g. block rewards) and assembles the final block. Note: The block header and state database might be updated to reflect any consensus rules that happen at finalization (e.g. block rewards).

func (*Dpovp) Prepare

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

Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.

func (*Dpovp) Seal

func (d *Dpovp) 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 (*Dpovp) SetCoinbase

func (d *Dpovp) SetCoinbase(coinbase common.Address)

设置coinbase

func (*Dpovp) VerifyHeader

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

VerifyHeader checks whether a header conforms to the consensus rules of a given engine. Verifying the seal may be done optionally here, or explicitly via the VerifySeal method.

func (*Dpovp) VerifyHeaders

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

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).

func (*Dpovp) VerifySeal

func (d *Dpovp) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.

func (*Dpovp) VerifyUncles

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

VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.

Jump to

Keyboard shortcuts

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