Documentation ¶
Index ¶
- Constants
- Variables
- func MigrationTx(signer types.Signer, header *types.Header, migration_file string, ...) (res *types.Transaction)
- type AccountsFn
- type ChainReader
- type ConsensusSigner
- func (cs ConsensusSigner) Equal(s2 types.Signer) bool
- func (cs ConsensusSigner) Hash(tx *types.Transaction) common.Hash
- func (cs ConsensusSigner) Sender(tx *types.Transaction) (common.Address, error)
- func (cs ConsensusSigner) SignatureValues(tx *types.Transaction, sig []byte) (r, s, v *big.Int, err error)
- type DiffFn
- type Energi
- func (e *Energi) APIs(chain ChainReader) []rpc.API
- func (e *Energi) Author(header *types.Header) (common.Address, error)
- func (e *Energi) CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
- func (e *Energi) Close() error
- func (e *Energi) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, []*types.Receipt, error)
- func (e *Energi) GetMinerNonceCap() uint64
- func (e *Energi) Prepare(chain ChainReader, header *types.Header) error
- func (e *Energi) Seal(chain ChainReader, block *types.Block, ...) (err error)
- func (e *Energi) SealHash(header *types.Header) (hash common.Hash)
- func (e *Energi) SetMinerCB(accountsFn AccountsFn, signerFn SignerFn, peerCountFn PeerCountFn)
- func (e *Energi) SetMinerNonceCap(nonceCap uint64)
- func (e *Energi) SignatureHash(header *types.Header) (hash common.Hash)
- func (e *Energi) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error
- func (e *Energi) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error, chan<- bool)
- func (e *Energi) VerifySeal(chain ChainReader, header *types.Header) error
- func (e *Energi) VerifyUncles(chain ChainReader, block *types.Block) error
- type KnownStakeKey
- type KnownStakeValue
- type KnownStakes
- type PeerCountFn
- type SignerFn
Constants ¶
const ( MaturityPeriod uint64 = energi_params.MaturityPeriod AverageTimeBlocks uint64 = energi_params.AverageTimeBlocks TargetBlockGap uint64 = energi_params.TargetBlockGap MinBlockGap uint64 = energi_params.MinBlockGap MaxFutureGap uint64 = energi_params.MaxFutureGap TargetPeriodGap uint64 = energi_params.TargetPeriodGap )
Variables ¶
Functions ¶
Types ¶
type AccountsFn ¶
type ChainReader ¶
type ChainReader = eth_consensus.ChainReader
type ConsensusSigner ¶
type ConsensusSigner struct{}
NOTE: it MUST NOT for untrusted transactions
func NewConsensusSigner ¶
func NewConsensusSigner() *ConsensusSigner
func (ConsensusSigner) Hash ¶
func (cs ConsensusSigner) Hash(tx *types.Transaction) common.Hash
func (ConsensusSigner) Sender ¶
func (cs ConsensusSigner) Sender(tx *types.Transaction) (common.Address, error)
func (ConsensusSigner) SignatureValues ¶
func (cs ConsensusSigner) SignatureValues(tx *types.Transaction, sig []byte) (r, s, v *big.Int, err error)
type Energi ¶
type Energi struct {
// contains filtered or unexported fields
}
func (*Energi) APIs ¶
func (e *Energi) APIs(chain ChainReader) []rpc.API
APIs returns the RPC APIs this consensus engine provides.
func (*Energi) Author ¶
Author retrieves the Ethereum address of the account that minted the given block, which may be different from the header's coinbase if a consensus engine is based on signatures.
func (*Energi) CalcDifficulty ¶
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have.
func (*Energi) Finalize ¶
func (e *Energi) Finalize( chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, ) (*types.Block, []*types.Receipt, 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 (*Energi) GetMinerNonceCap ¶ added in v0.8.3
func (*Energi) Prepare ¶
func (e *Energi) Prepare(chain 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 (*Energi) Seal ¶
func (e *Energi) Seal( chain ChainReader, block *types.Block, results chan<- *eth_consensus.SealResult, stop <-chan struct{}, ) (err error)
Seal generates a new sealing request for the given input block and pushes the result into the given channel.
Note, the method returns immediately and will send the result async. More than one result may also be returned depending on the consensus algorithm.
func (*Energi) SetMinerCB ¶
func (e *Energi) SetMinerCB( accountsFn AccountsFn, signerFn SignerFn, peerCountFn PeerCountFn, )
func (*Energi) SetMinerNonceCap ¶
func (*Energi) SignatureHash ¶
func (*Energi) 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 (*Energi) VerifyHeaders ¶
func (e *Energi) VerifyHeaders( chain ChainReader, headers []*types.Header, seals []bool, ) ( chan<- struct{}, <-chan error, chan<- bool, )
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 (*Energi) VerifySeal ¶
func (e *Energi) VerifySeal(chain 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 (*Energi) VerifyUncles ¶
func (e *Energi) VerifyUncles(chain ChainReader, block *types.Block) error
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.
type KnownStakeKey ¶
type KnownStakeKey struct {
// contains filtered or unexported fields
}
type KnownStakeValue ¶
type KnownStakeValue struct {
// contains filtered or unexported fields
}
type KnownStakes ¶
type PeerCountFn ¶
type PeerCountFn func() int