backend

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a user facing RPC API to dump Istanbul state

func (*API) GetContractABI added in v0.2.1

func (api *API) GetContractABI() string

Get Autonity contract ABI

func (*API) GetContractAddress added in v0.2.1

func (api *API) GetContractAddress() common.Address

Get Autonity contract address

func (*API) GetValidators

func (api *API) GetValidators(number *rpc.BlockNumber) ([]common.Address, error)

GetValidators retrieves the list of authorized validators at the specified block.

func (*API) GetValidatorsAtHash

func (api *API) GetValidatorsAtHash(hash common.Hash) ([]common.Address, error)

GetValidatorsAtHash retrieves the state snapshot at a given block.

func (*API) GetWhitelist

func (api *API) GetWhitelist() []string

Get current white list

type Backend

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

func New

func New(config *istanbul.Config, privateKey *ecdsa.PrivateKey, db ethdb.Database, chainConfig *params.ChainConfig, vmConfig *vm.Config) *Backend

New creates an Ethereum Backend for Istanbul core engine.

func (*Backend) APIs

func (sb *Backend) APIs(chain consensus.ChainReader) []rpc.API

APIs returns the RPC APIs this consensus engine provides.

func (*Backend) Address

func (sb *Backend) Address() common.Address

Address implements istanbul.Backend.Address

func (*Backend) Author

func (sb *Backend) 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 (*Backend) Broadcast

func (sb *Backend) Broadcast(valSet istanbul.ValidatorSet, payload []byte) error

Broadcast implements istanbul.Backend.Broadcast

func (*Backend) CalcDifficulty

func (sb *Backend) 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 based on the previous blocks in the blockchain and the current signer.

func (*Backend) CheckSignature

func (sb *Backend) CheckSignature(data []byte, address common.Address, sig []byte) error

CheckSignature implements istanbul.Backend.CheckSignature

func (*Backend) Close

func (sb *Backend) Close() error

Stop implements consensus.BFT.Stop

func (*Backend) Commit

func (sb *Backend) Commit(proposal istanbul.Proposal, seals [][]byte) error

Commit implements istanbul.Backend.Commit

func (*Backend) EventMux

func (sb *Backend) EventMux() *event.TypeMux

EventMux implements istanbul.Backend.EventMux

func (*Backend) Finalize

func (sb *Backend) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
	uncles []*types.Header)

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 (*Backend) FinalizeAndAssemble added in v0.2.1

func (sb *Backend) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, txs []*types.Transaction,
	uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

func (*Backend) GetProposer

func (sb *Backend) GetProposer(number uint64) common.Address

GetProposer implements istanbul.Backend.GetProposer

func (*Backend) Gossip

func (sb *Backend) Gossip(valSet istanbul.ValidatorSet, payload []byte) error

Broadcast implements istanbul.Backend.Gossip

func (*Backend) HandleMsg

func (sb *Backend) HandleMsg(addr common.Address, msg p2p.Msg) (bool, error)

HandleMsg implements consensus.Handler.HandleMsg

func (*Backend) HasBadProposal

func (sb *Backend) HasBadProposal(hash common.Hash) bool

func (*Backend) HasPropsal

func (sb *Backend) HasPropsal(hash common.Hash, number *big.Int) bool

HasPropsal implements istanbul.Backend.HashBlock

func (*Backend) LastProposal

func (sb *Backend) LastProposal() (istanbul.Proposal, common.Address)

func (*Backend) NewChainHead

func (sb *Backend) NewChainHead() error

func (*Backend) Prepare

func (sb *Backend) 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 (*Backend) Protocol

func (sb *Backend) Protocol() (protocolName string, extraMsgCodes uint64)

Protocol implements consensus.Handler.Protocol

func (*Backend) Seal

func (sb *Backend) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal generates a new block for the given input block with the local miner's seal place on top.

func (*Backend) SealHash

func (sb *Backend) SealHash(header *types.Header) common.Hash

func (*Backend) SetBroadcaster

func (sb *Backend) SetBroadcaster(broadcaster consensus.Broadcaster)

SetBroadcaster implements consensus.Handler.SetBroadcaster

func (*Backend) SetProposedBlockHash

func (sb *Backend) SetProposedBlockHash(hash common.Hash)

func (*Backend) Sign

func (sb *Backend) Sign(data []byte) ([]byte, error)

Sign implements istanbul.Backend.Sign

func (*Backend) Start

func (sb *Backend) Start(_ context.Context, chain consensus.ChainReader, currentBlock func() *types.Block, hasBadBlock func(hash common.Hash) bool) error

Start implements consensus.BFT.Start

func (*Backend) Validators

func (sb *Backend) Validators(number uint64) istanbul.ValidatorSet

func (*Backend) Verify

func (sb *Backend) Verify(proposal istanbul.Proposal) (time.Duration, error)

Verify implements istanbul.Backend.Verify

func (*Backend) VerifyHeader

func (sb *Backend) 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 (*Backend) VerifyHeaders

func (sb *Backend) 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 (*Backend) VerifySeal

func (sb *Backend) 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 (*Backend) VerifyUncles

func (sb *Backend) 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.

func (*Backend) WhiteList

func (sb *Backend) WhiteList() []string

Whitelist for the current block

Jump to

Keyboard shortcuts

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