Documentation ¶
Index ¶
- Variables
- type Backend
- type DElection
- func (dpos *DElection) APIs(chain consensus.ChainReader) []rpc.API
- func (dpos *DElection) Author(header *types.Header) (common.Address, error)
- func (dpos *DElection) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (dpos *DElection) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (dpos *DElection) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (dpos *DElection) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (dpos *DElection) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (dpos *DElection) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (dpos *DElection) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (dpos *DElection) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type DPoSAPI
- type Packager
- type Work
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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 ¶
VerifySeal implements consensus.Engine, checking whether the given block satisfies the DPoS difficulty requirements.
func (*DElection) VerifyUncles ¶
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.
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