Documentation ¶
Overview ¶
implements for Dpovp consensus
Index ¶
- Variables
- type Dpovp
- func (d *Dpovp) APIs(chain consensus.ChainReader) []rpc.API
- func (d *Dpovp) Author(header *types.Header) (common.Address, error)
- func (d *Dpovp) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (d *Dpovp) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (d *Dpovp) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (d *Dpovp) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (d *Dpovp) SetCoinbase(coinbase common.Address)
- func (d *Dpovp) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (d *Dpovp) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (d *Dpovp) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (d *Dpovp) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
Constants ¶
This section is empty.
Variables ¶
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 NewFakeDelayer ¶
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 ¶
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 ¶
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 ¶
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) VerifyHeader ¶
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 ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*Dpovp) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.