Documentation
¶
Index ¶
- Variables
- type API
- type Backend
- func (sb *Backend) APIs(chain consensus.ChainReader) []rpc.API
- func (sb *Backend) AddSeal(block *types.Block) (*types.Block, error)
- func (sb *Backend) Address() common.Address
- func (sb *Backend) AskSync(header *types.Header)
- func (sb *Backend) Author(header *types.Header) (common.Address, error)
- func (sb *Backend) AutonityContractFinalize(header *types.Header, chain consensus.ChainReader, state *state.StateDB, ...) (types.Committee, *types.Receipt, error)
- func (sb *Backend) BlockChain() *core.BlockChain
- func (sb *Backend) Broadcast(ctx context.Context, committee types.Committee, payload []byte) error
- func (sb *Backend) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (sb *Backend) CheckSignature(data []byte, address common.Address, sig []byte) error
- func (sb *Backend) Close() error
- func (sb *Backend) Commit(proposal *types.Block, round int64, seals [][]byte) error
- func (sb *Backend) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (types.Committee, *types.Receipt, error)
- func (sb *Backend) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, ...) (*types.Block, error)
- func (sb *Backend) GetContractABI() string
- func (sb *Backend) Gossip(ctx context.Context, committee types.Committee, payload []byte)
- func (sb *Backend) HandleMsg(addr common.Address, msg p2p.Msg) (bool, error)
- func (sb *Backend) HandleUnhandledMsgs(ctx context.Context)
- func (sb *Backend) HasBadProposal(hash common.Hash) bool
- func (sb *Backend) LastCommittedProposal() (*types.Block, common.Address)
- func (sb *Backend) NewChainHead() error
- func (sb *Backend) Post(ev interface{})
- func (sb *Backend) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (sb *Backend) Protocol() (protocolName string, extraMsgCodes uint64)
- func (sb *Backend) ResetPeerCache(address common.Address)
- func (sb *Backend) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (sb *Backend) SealHash(header *types.Header) common.Hash
- func (sb *Backend) SetBlockchain(bc *core.BlockChain)
- func (sb *Backend) SetBroadcaster(broadcaster consensus.Broadcaster)
- func (sb *Backend) SetProposedBlockHash(hash common.Hash)
- func (sb *Backend) Sign(data []byte) ([]byte, error)
- func (sb *Backend) Start(ctx context.Context) error
- func (sb *Backend) Subscribe(types ...interface{}) *event.TypeMuxSubscription
- func (sb *Backend) SyncPeer(address common.Address)
- func (sb *Backend) VerifyHeader(chain consensus.ChainReader, header *types.Header, _ bool) error
- func (sb *Backend) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (sb *Backend) VerifyProposal(proposal types.Block) (time.Duration, error)
- func (sb *Backend) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (sb *Backend) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- func (sb *Backend) WhiteList() []string
- type Changes
- type Modifier
- type ModifyCommitteeEngine
- func NewAddValidator(t *testing.T, engine consensus.Engine, changedValidators Changes, ...) *ModifyCommitteeEngine
- func NewRemoveValidator(t *testing.T, engine consensus.Engine, changedValidators Changes, ...) *ModifyCommitteeEngine
- func NewReplaceValidator(t *testing.T, engine consensus.Engine, changedValidators Changes, ...) *ModifyCommitteeEngine
- func (m *ModifyCommitteeEngine) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (m *ModifyCommitteeEngine) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (m *ModifyCommitteeEngine) VerifyProposal(block types.Block) (time.Duration, error)
- type UnhandledMsg
Constants ¶
This section is empty.
Variables ¶
var ( // current validator set. ErrUnauthorizedAddress = errors.New("unauthorized address") // ErrStoppedEngine is returned if the engine is stopped ErrStoppedEngine = errors.New("stopped engine") )
var ErrStartedEngine = errors.New("started engine")
ErrStartedEngine is returned if the engine is already started
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 BFT state
func (*API) GetCommittee ¶ added in v0.4.0
GetCommittee retrieves the list of authorized committee at the specified block.
func (*API) GetCommitteeAtHash ¶ added in v0.4.0
GetCommitteeAtHash retrieves the state snapshot at a given block.
func (*API) GetContractABI ¶ added in v0.2.1
Get Autonity contract ABI
func (*API) GetContractAddress ¶ added in v0.2.1
Get Autonity contract address
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func New ¶
func New(config *tendermintConfig.Config, privateKey *ecdsa.PrivateKey, db ethdb.Database, chainConfig *params.ChainConfig, vmConfig *vm.Config) *Backend
New creates an Ethereum Backend for BFT 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) AddSeal ¶ added in v0.4.0
update timestamp and signature of the block based on its number of transactions
func (*Backend) 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 (*Backend) AutonityContractFinalize ¶ added in v0.4.0
func (sb *Backend) AutonityContractFinalize(header *types.Header, chain consensus.ChainReader, state *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt) (types.Committee, *types.Receipt, error)
AutonityContractFinalize is called to deploy the Autonity Contract at block #1. it returns as well the committee field containaining the list of committee members allowed to participate in consensus for the next block.
func (*Backend) BlockChain ¶ added in v0.5.0
func (sb *Backend) BlockChain() *core.BlockChain
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 ¶
CheckSignature implements tendermint.Backend.CheckSignature
func (*Backend) Finalize ¶
func (sb *Backend) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (types.Committee, *types.Receipt, error)
Finalize runs any post-transaction state modifications (e.g. block rewards) Finaize doesn't modify the passed header.
func (*Backend) FinalizeAndAssemble ¶ added in v0.1.6
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)
FinalizeAndAssemble call Finaize to compute post transacation state modifications and assembles the final block.
func (*Backend) GetContractABI ¶ added in v0.3.0
func (*Backend) HandleUnhandledMsgs ¶ added in v0.3.0
func (*Backend) LastCommittedProposal ¶
func (*Backend) NewChainHead ¶
func (*Backend) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.
func (*Backend) ResetPeerCache ¶ added in v0.1.6
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) SetBlockchain ¶ added in v0.5.0
func (sb *Backend) SetBlockchain(bc *core.BlockChain)
func (*Backend) SetBroadcaster ¶
func (sb *Backend) SetBroadcaster(broadcaster consensus.Broadcaster)
SetBroadcaster implements consensus.Handler.SetBroadcaster
func (*Backend) SetProposedBlockHash ¶
func (*Backend) Subscribe ¶ added in v0.1.6
func (sb *Backend) Subscribe(types ...interface{}) *event.TypeMuxSubscription
func (*Backend) 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 (*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) VerifyProposal ¶
VerifyProposal implements tendermint.Backend.VerifyProposal
func (*Backend) VerifySeal ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*Backend) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of a given engine.
type Changes ¶ added in v0.5.0
type Changes struct {
// contains filtered or unexported fields
}
func NewChanges ¶ added in v0.5.0
func NewChanges() Changes
type ModifyCommitteeEngine ¶ added in v0.5.0
type ModifyCommitteeEngine struct { *testing.T *Backend Modifier // contains filtered or unexported fields }
func NewAddValidator ¶ added in v0.5.0
func NewRemoveValidator ¶ added in v0.5.0
func NewReplaceValidator ¶ added in v0.5.0
func (*ModifyCommitteeEngine) FinalizeAndAssemble ¶ added in v0.5.0
func (*ModifyCommitteeEngine) VerifyHeader ¶ added in v0.5.0
func (m *ModifyCommitteeEngine) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
func (*ModifyCommitteeEngine) VerifyProposal ¶ added in v0.5.0
type UnhandledMsg ¶ added in v0.3.0
type UnhandledMsg struct {
// contains filtered or unexported fields
}