pbft

package
v0.0.0-...-ea7b605 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcDifficulty

func CalcDifficulty() *big.Int

func PbftRLP

func PbftRLP(header *types.Header) []byte

func SealHash

func SealHash(header *types.Header) (hash common.Hash)

SealHash returns the hash of a block prior to it being sealed.

Types

type API

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

func (*API) AddClient

func (api *API) AddClient(someone common.Address) bool

type Pbft

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

func New

func New(config *params.PbftConfig, db ethdb.Database) *Pbft

func (*Pbft) APIs

func (p *Pbft) APIs(chain consensus.ChainReader) []rpc.API

APIs returns the RPC APIs this consensus engine provides.

func (*Pbft) AddClient

func (p *Pbft) AddClient(client common.Address) bool

func (*Pbft) Author

func (p *Pbft) Author(header *types.Header) (common.Address, error)

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) Authorize

func (p *Pbft) Authorize(signer common.Address, signFn SignerFn)

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) Close

func (p *Pbft) Close() error

Close terminates any background threads maintained by the consensus engine.

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) IsPrimary

func (p *Pbft) IsPrimary(producer common.Address, blockNumber uint64) bool

func (*Pbft) Prepare

func (p *Pbft) Prepare(chain consensus.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 (*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) SealHash

func (p *Pbft) SealHash(header *types.Header) common.Hash

SealHash returns the hash of a block prior to it being sealed.

func (*Pbft) VerifyHeader

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

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

func (p *Pbft) VerifySeal(chain consensus.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 (*Pbft) VerifyUncles

func (p *Pbft) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

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

type PbftClients

type PbftClients []common.Address

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)

type SignerFn

type SignerFn func(accounts.Account, string, []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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