dpos

package
v0.0.0-...-457eeb3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium

)

DElection proof-of-work protocol constants.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	AccountManager() *account.Manager
	BlockChain() *core.BlockChain
	TxPool() *core.TxPool
	ChainDb() store.Database
}

Backend wraps all methods required for mining.

type DElection

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

func New

func New(config *config.DPoSConfig, db store.Database) *DElection

New creates a Clique proof-of-authority consensus engine with the initial signers set to the ones provided by the user.

func (*DElection) APIs

func (dpos *DElection) APIs(chain consensus.ChainReader) []rpc.API

APIs returns the RPC APIs this consensus engine provides.

func (*DElection) Author

func (dpos *DElection) Author(header *types.Header) (common.Address, error)

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

func (*DElection) CalcDifficulty

func (dpos *DElection) 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 when created at time given the parent block's time and difficulty.

func (*DElection) Finalize

func (dpos *DElection) 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 (*DElection) Prepare

func (dpos *DElection) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the dpos protocol. The changes are done inline.

func (*DElection) Seal

func (dpos *DElection) 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 (*DElection) VerifyHeader

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

VerifyHeader checks whether a header conforms to the consensus rules of the stock Ethereum dpos engine.

func (*DElection) VerifyHeaders

func (dpos *DElection) 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.

func (*DElection) VerifySeal

func (dpos *DElection) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the given block satisfies the DPoS difficulty requirements.

func (*DElection) VerifyUncles

func (dpos *DElection) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

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

type DPoSAPI

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

PublicDebugAPI is the collection of Ethereum APIs exposed over the public debugging endpoint.

func (*DPoSAPI) Test

func (dpos *DPoSAPI) Test() string

type Packager

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

Packager is the main object which takes care of applying messages to the new state

func NewPackager

func NewPackager(config *config.ChainConfig, engine consensus.Engine, coinbase common.Address, eth Backend, mux *event.TypeMux) *Packager

func NewPackager1

func NewPackager1(config *config.ChainConfig, engine consensus.Engine, coinbase common.Address, blockChain *core.BlockChain, txPool *core.TxPool, mux *event.TypeMux) *Packager

func (*Packager) GenerateNewBlock

func (self *Packager) GenerateNewBlock(round uint64, presidentId string) *types.Block

func (*Packager) Start

func (self *Packager) Start()

func (*Packager) Stop

func (self *Packager) Stop()

type Work

type Work struct {
	Block *types.Block // the new block
	// contains filtered or unexported fields
}

Work is the workers current environment and holds all of the current state information

Jump to

Keyboard shortcuts

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