Documentation ¶
Index ¶
- func CalcDifficulty() *big.Int
- func PbftRLP(header *types.Header) []byte
- func SealHash(header *types.Header) (hash common.Hash)
- type API
- type Pbft
- func (p *Pbft) APIs(chain consensus.ChainReader) []rpc.API
- func (p *Pbft) AddClient(client common.Address) bool
- func (p *Pbft) Author(header *types.Header) (common.Address, error)
- func (p *Pbft) Authorize(signer common.Address, signFn SignerFn)
- func (p *Pbft) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (p *Pbft) Close() error
- func (p *Pbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (p *Pbft) IsPrimary(producer common.Address, blockNumber uint64) bool
- func (p *Pbft) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (p *Pbft) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (p *Pbft) SealHash(header *types.Header) common.Hash
- func (p *Pbft) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (p *Pbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (p *Pbft) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (p *Pbft) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type PbftClients
- type SignerFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcDifficulty ¶
Types ¶
type Pbft ¶
type Pbft struct {
// contains filtered or unexported fields
}
func (*Pbft) APIs ¶
func (p *Pbft) APIs(chain consensus.ChainReader) []rpc.API
APIs returns the RPC APIs this consensus engine provides.
func (*Pbft) 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 (*Pbft) CalcDifficulty ¶
func (p *Pbft) 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 (*Pbft) Finalize ¶
func (p *Pbft) 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 (*Pbft) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.
func (*Pbft) Seal ¶
func (p *Pbft) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) 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 (*Pbft) 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 (*Pbft) VerifyHeaders ¶
func (p *Pbft) 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 (*Pbft) VerifySeal ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*Pbft) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.
type PbftClients ¶
func (PbftClients) Len ¶
func (s PbftClients) Len() int
func (PbftClients) Less ¶
func (s PbftClients) Less(i, j int) bool
func (PbftClients) Swap ¶
func (s PbftClients) Swap(i, j int)