Documentation
¶
Overview ¶
Package consensus implements different Ethereum consensus engines.
Package consensus is a generated GoMock package.
Package consensus implements different Ethereum consensus engines.
Package consensus is a generated GoMock package.
Index ¶
- Variables
- type BFT
- type Broadcaster
- type ChainReader
- type Engine
- type Handler
- type MockBFT
- func (m *MockBFT) APIs(chain ChainReader) []rpc.API
- func (m *MockBFT) Author(header *types.Header) (common.Address, error)
- func (m *MockBFT) CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
- func (m *MockBFT) Close() error
- func (m *MockBFT) EXPECT() *MockBFTMockRecorder
- func (m *MockBFT) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, ...) (types.Committee, *types.Receipt, error)
- func (m *MockBFT) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (m *MockBFT) Prepare(chain ChainReader, header *types.Header) error
- func (m *MockBFT) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (m *MockBFT) SealHash(header *types.Header) common.Hash
- func (m *MockBFT) Start(ctx context.Context) error
- func (m *MockBFT) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error
- func (m *MockBFT) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (m *MockBFT) VerifySeal(chain ChainReader, header *types.Header) error
- func (m *MockBFT) VerifyUncles(chain ChainReader, block *types.Block) error
- type MockBFTMockRecorder
- func (mr *MockBFTMockRecorder) APIs(chain interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) Author(header interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) Close() *gomock.Call
- func (mr *MockBFTMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) Prepare(chain, header interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) SealHash(header interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) Start(ctx interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
- func (mr *MockBFTMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
- type MockBroadcaster
- type MockBroadcasterMockRecorder
- type MockChainReader
- func (m *MockChainReader) Config() *params.ChainConfig
- func (m *MockChainReader) CurrentHeader() *types.Header
- func (m *MockChainReader) EXPECT() *MockChainReaderMockRecorder
- func (m *MockChainReader) Engine() Engine
- func (m *MockChainReader) GetBlock(hash common.Hash, number uint64) *types.Block
- func (m *MockChainReader) GetHeader(hash common.Hash, number uint64) *types.Header
- func (m *MockChainReader) GetHeaderByHash(hash common.Hash) *types.Header
- func (m *MockChainReader) GetHeaderByNumber(number uint64) *types.Header
- type MockChainReaderMockRecorder
- func (mr *MockChainReaderMockRecorder) Config() *gomock.Call
- func (mr *MockChainReaderMockRecorder) CurrentHeader() *gomock.Call
- func (mr *MockChainReaderMockRecorder) Engine() *gomock.Call
- func (mr *MockChainReaderMockRecorder) GetBlock(hash, number interface{}) *gomock.Call
- func (mr *MockChainReaderMockRecorder) GetHeader(hash, number interface{}) *gomock.Call
- func (mr *MockChainReaderMockRecorder) GetHeaderByHash(hash interface{}) *gomock.Call
- func (mr *MockChainReaderMockRecorder) GetHeaderByNumber(number interface{}) *gomock.Call
- type MockEngine
- func (m *MockEngine) APIs(chain ChainReader) []rpc.API
- func (m *MockEngine) Author(header *types.Header) (common.Address, error)
- func (m *MockEngine) CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
- func (m *MockEngine) Close() error
- func (m *MockEngine) EXPECT() *MockEngineMockRecorder
- func (m *MockEngine) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, ...) (types.Committee, *types.Receipt, error)
- func (m *MockEngine) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (m *MockEngine) Prepare(chain ChainReader, header *types.Header) error
- func (m *MockEngine) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (m *MockEngine) SealHash(header *types.Header) common.Hash
- func (m *MockEngine) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error
- func (m *MockEngine) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (m *MockEngine) VerifySeal(chain ChainReader, header *types.Header) error
- func (m *MockEngine) VerifyUncles(chain ChainReader, block *types.Block) error
- type MockEngineMockRecorder
- func (mr *MockEngineMockRecorder) APIs(chain interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) Author(header interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) Close() *gomock.Call
- func (mr *MockEngineMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) Prepare(chain, header interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) SealHash(header interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
- func (mr *MockEngineMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
- type MockHandler
- type MockHandlerMockRecorder
- type MockPeer
- type MockPeerMockRecorder
- type MockPoW
- func (m *MockPoW) APIs(chain ChainReader) []rpc.API
- func (m *MockPoW) Author(header *types.Header) (common.Address, error)
- func (m *MockPoW) CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
- func (m *MockPoW) Close() error
- func (m *MockPoW) EXPECT() *MockPoWMockRecorder
- func (m *MockPoW) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, ...) (types.Committee, *types.Receipt, error)
- func (m *MockPoW) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (m *MockPoW) Hashrate() float64
- func (m *MockPoW) Prepare(chain ChainReader, header *types.Header) error
- func (m *MockPoW) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (m *MockPoW) SealHash(header *types.Header) common.Hash
- func (m *MockPoW) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error
- func (m *MockPoW) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (m *MockPoW) VerifySeal(chain ChainReader, header *types.Header) error
- func (m *MockPoW) VerifyUncles(chain ChainReader, block *types.Block) error
- type MockPoWMockRecorder
- func (mr *MockPoWMockRecorder) APIs(chain interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) Author(header interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) Close() *gomock.Call
- func (mr *MockPoWMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) Hashrate() *gomock.Call
- func (mr *MockPoWMockRecorder) Prepare(chain, header interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) SealHash(header interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
- func (mr *MockPoWMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
- type MockSyncer
- type MockSyncerMockRecorder
- type Peer
- type PoW
- type Syncer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownAncestor is returned when validating a block requires an ancestor // that is unknown. ErrUnknownAncestor = errors.New("unknown ancestor") // ErrPrunedAncestor is returned when validating a block requires an ancestor // that is known, but the state of which is not available. ErrPrunedAncestor = errors.New("pruned ancestor") // ErrFutureBlock is returned when a block's timestamp is in the future according // to the current node. ErrFutureBlock = errors.New("block in the future") // ErrInvalidNumber is returned if a block's number doesn't equal its parent's // plus one. ErrInvalidNumber = errors.New("invalid block number") // ErrInconsistentCommitteeSet is returned if the committee set is inconsistent ErrInconsistentCommitteeSet = errors.New("inconsistent committee set") // ErrCommitteeMemberNotFound is returned if the committee member is missing from // the committee set. ErrCommitteeMemberNotFound = errors.New("committee member not found") )
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster interface { // Enqueue add a block into fetcher queue Enqueue(id string, block *types.Block) // FindPeers retrives connected peers by addresses FindPeers(map[common.Address]struct{}) map[common.Address]Peer }
Broadcaster defines the interface to enqueue blocks to fetcher and find peer
type ChainReader ¶
type ChainReader interface { // Config retrieves the blockchain's chain configuration. Config() *params.ChainConfig // CurrentHeader retrieves the current header from the local chain. CurrentHeader() *types.Header // GetHeader retrieves a block header from the database by hash and number. GetHeader(hash common.Hash, number uint64) *types.Header // GetHeaderByNumber retrieves a block header from the database by number. GetHeaderByNumber(number uint64) *types.Header // GetHeaderByHash retrieves a block header from the database by its hash. GetHeaderByHash(hash common.Hash) *types.Header // GetBlock retrieves a block from the database by hash and number. GetBlock(hash common.Hash, number uint64) *types.Block // Engine retrieves the chain's consensus engine. Engine() Engine }
ChainReader defines a small collection of methods needed to access the local blockchain during header and/or uncle verification.
type Engine ¶
type Engine interface { // 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. Author(header *types.Header) (common.Address, 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. VerifyHeader(chain ChainReader, header *types.Header, seal bool) 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). VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) // VerifyUncles verifies that the given block's uncles conform to the consensus // rules of a given engine. VerifyUncles(chain ChainReader, block *types.Block) error // VerifySeal checks whether the crypto seal on a header is valid according to // the consensus rules of the given engine. VerifySeal(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. Prepare(chain ChainReader, header *types.Header) error // Finalize runs any post-transaction state modifications (e.g. block rewards) // but does not assemble the block. // // Note: The block header and state database might be updated to reflect any // consensus rules that happen at finalization (e.g. block rewards). Finalize(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (types.Committee, *types.Receipt, error) // FinalizeAndAssemble 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). FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts *[]*types.Receipt) (*types.Block, 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. Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error // SealHash returns the hash of a block prior to it being sealed. SealHash(header *types.Header) common.Hash // CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty // that a new block should have. CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int // APIs returns the RPC APIs this consensus engine provides. APIs(chain ChainReader) []rpc.API // Close terminates any background threads maintained by the consensus engine. Close() error }
Engine is an algorithm agnostic consensus engine.
type Handler ¶
type Handler interface { // NewChainHead handles a new head block comes NewChainHead() error // HandleMsg handles a message from peer HandleMsg(address common.Address, data p2p.Msg) (bool, error) // SetBroadcaster sets the broadcaster to send message to peers SetBroadcaster(Broadcaster) //msgCodes returns the number of extra implemented msgCodes by this consensus algorithm Protocol() (protocolName string, extraMsgCodes uint64) }
Handler should be implemented is the consensus needs to handle and send peer's message
type MockBFT ¶ added in v0.3.0
type MockBFT struct {
// contains filtered or unexported fields
}
MockBFT is a mock of BFT interface
func NewMockBFT ¶ added in v0.3.0
func NewMockBFT(ctrl *gomock.Controller) *MockBFT
NewMockBFT creates a new mock instance
func (*MockBFT) APIs ¶ added in v0.3.0
func (m *MockBFT) APIs(chain ChainReader) []rpc.API
APIs mocks base method
func (*MockBFT) CalcDifficulty ¶ added in v0.3.0
CalcDifficulty mocks base method
func (*MockBFT) EXPECT ¶ added in v0.3.0
func (m *MockBFT) EXPECT() *MockBFTMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockBFT) Finalize ¶ added in v0.3.0
func (m *MockBFT) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (types.Committee, *types.Receipt, error)
Finalize mocks base method
func (*MockBFT) FinalizeAndAssemble ¶ added in v0.3.0
func (m *MockBFT) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts *[]*types.Receipt) (*types.Block, error)
FinalizeAndAssemble mocks base method
func (*MockBFT) Prepare ¶ added in v0.3.0
func (m *MockBFT) Prepare(chain ChainReader, header *types.Header) error
Prepare mocks base method
func (*MockBFT) Seal ¶ added in v0.3.0
func (m *MockBFT) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal mocks base method
func (*MockBFT) VerifyHeader ¶ added in v0.3.0
VerifyHeader mocks base method
func (*MockBFT) VerifyHeaders ¶ added in v0.3.0
func (m *MockBFT) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders mocks base method
func (*MockBFT) VerifySeal ¶ added in v0.3.0
func (m *MockBFT) VerifySeal(chain ChainReader, header *types.Header) error
VerifySeal mocks base method
func (*MockBFT) VerifyUncles ¶ added in v0.3.0
func (m *MockBFT) VerifyUncles(chain ChainReader, block *types.Block) error
VerifyUncles mocks base method
type MockBFTMockRecorder ¶ added in v0.3.0
type MockBFTMockRecorder struct {
// contains filtered or unexported fields
}
MockBFTMockRecorder is the mock recorder for MockBFT
func (*MockBFTMockRecorder) APIs ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) APIs(chain interface{}) *gomock.Call
APIs indicates an expected call of APIs
func (*MockBFTMockRecorder) Author ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Author(header interface{}) *gomock.Call
Author indicates an expected call of Author
func (*MockBFTMockRecorder) CalcDifficulty ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
CalcDifficulty indicates an expected call of CalcDifficulty
func (*MockBFTMockRecorder) Close ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockBFTMockRecorder) Finalize ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
Finalize indicates an expected call of Finalize
func (*MockBFTMockRecorder) FinalizeAndAssemble ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
FinalizeAndAssemble indicates an expected call of FinalizeAndAssemble
func (*MockBFTMockRecorder) Prepare ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Prepare(chain, header interface{}) *gomock.Call
Prepare indicates an expected call of Prepare
func (*MockBFTMockRecorder) Seal ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
Seal indicates an expected call of Seal
func (*MockBFTMockRecorder) SealHash ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) SealHash(header interface{}) *gomock.Call
SealHash indicates an expected call of SealHash
func (*MockBFTMockRecorder) Start ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) Start(ctx interface{}) *gomock.Call
Start indicates an expected call of Start
func (*MockBFTMockRecorder) VerifyHeader ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
VerifyHeader indicates an expected call of VerifyHeader
func (*MockBFTMockRecorder) VerifyHeaders ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
VerifyHeaders indicates an expected call of VerifyHeaders
func (*MockBFTMockRecorder) VerifySeal ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
VerifySeal indicates an expected call of VerifySeal
func (*MockBFTMockRecorder) VerifyUncles ¶ added in v0.3.0
func (mr *MockBFTMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
VerifyUncles indicates an expected call of VerifyUncles
type MockBroadcaster ¶ added in v0.3.0
type MockBroadcaster struct {
// contains filtered or unexported fields
}
MockBroadcaster is a mock of Broadcaster interface
func NewMockBroadcaster ¶ added in v0.3.0
func NewMockBroadcaster(ctrl *gomock.Controller) *MockBroadcaster
NewMockBroadcaster creates a new mock instance
func (*MockBroadcaster) EXPECT ¶ added in v0.3.0
func (m *MockBroadcaster) EXPECT() *MockBroadcasterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockBroadcasterMockRecorder ¶ added in v0.3.0
type MockBroadcasterMockRecorder struct {
// contains filtered or unexported fields
}
MockBroadcasterMockRecorder is the mock recorder for MockBroadcaster
func (*MockBroadcasterMockRecorder) Enqueue ¶ added in v0.3.0
func (mr *MockBroadcasterMockRecorder) Enqueue(id, block interface{}) *gomock.Call
Enqueue indicates an expected call of Enqueue
func (*MockBroadcasterMockRecorder) FindPeers ¶ added in v0.3.0
func (mr *MockBroadcasterMockRecorder) FindPeers(arg0 interface{}) *gomock.Call
FindPeers indicates an expected call of FindPeers
type MockChainReader ¶ added in v0.3.0
type MockChainReader struct {
// contains filtered or unexported fields
}
MockChainReader is a mock of ChainReader interface
func NewMockChainReader ¶ added in v0.3.0
func NewMockChainReader(ctrl *gomock.Controller) *MockChainReader
NewMockChainReader creates a new mock instance
func (*MockChainReader) Config ¶ added in v0.3.0
func (m *MockChainReader) Config() *params.ChainConfig
Config mocks base method
func (*MockChainReader) CurrentHeader ¶ added in v0.3.0
func (m *MockChainReader) CurrentHeader() *types.Header
CurrentHeader mocks base method
func (*MockChainReader) EXPECT ¶ added in v0.3.0
func (m *MockChainReader) EXPECT() *MockChainReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockChainReader) Engine ¶ added in v0.3.0
func (m *MockChainReader) Engine() Engine
Engine mocks base method
func (*MockChainReader) GetHeaderByHash ¶ added in v0.3.0
func (m *MockChainReader) GetHeaderByHash(hash common.Hash) *types.Header
GetHeaderByHash mocks base method
func (*MockChainReader) GetHeaderByNumber ¶ added in v0.3.0
func (m *MockChainReader) GetHeaderByNumber(number uint64) *types.Header
GetHeaderByNumber mocks base method
type MockChainReaderMockRecorder ¶ added in v0.3.0
type MockChainReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockChainReaderMockRecorder is the mock recorder for MockChainReader
func (*MockChainReaderMockRecorder) Config ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) Config() *gomock.Call
Config indicates an expected call of Config
func (*MockChainReaderMockRecorder) CurrentHeader ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) CurrentHeader() *gomock.Call
CurrentHeader indicates an expected call of CurrentHeader
func (*MockChainReaderMockRecorder) Engine ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) Engine() *gomock.Call
Engine indicates an expected call of Engine
func (*MockChainReaderMockRecorder) GetBlock ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) GetBlock(hash, number interface{}) *gomock.Call
GetBlock indicates an expected call of GetBlock
func (*MockChainReaderMockRecorder) GetHeader ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) GetHeader(hash, number interface{}) *gomock.Call
GetHeader indicates an expected call of GetHeader
func (*MockChainReaderMockRecorder) GetHeaderByHash ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) GetHeaderByHash(hash interface{}) *gomock.Call
GetHeaderByHash indicates an expected call of GetHeaderByHash
func (*MockChainReaderMockRecorder) GetHeaderByNumber ¶ added in v0.3.0
func (mr *MockChainReaderMockRecorder) GetHeaderByNumber(number interface{}) *gomock.Call
GetHeaderByNumber indicates an expected call of GetHeaderByNumber
type MockEngine ¶ added in v0.3.0
type MockEngine struct {
// contains filtered or unexported fields
}
MockEngine is a mock of Engine interface
func NewMockEngine ¶ added in v0.3.0
func NewMockEngine(ctrl *gomock.Controller) *MockEngine
NewMockEngine creates a new mock instance
func (*MockEngine) APIs ¶ added in v0.3.0
func (m *MockEngine) APIs(chain ChainReader) []rpc.API
APIs mocks base method
func (*MockEngine) CalcDifficulty ¶ added in v0.3.0
func (m *MockEngine) CalcDifficulty(chain ChainReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty mocks base method
func (*MockEngine) Close ¶ added in v0.3.0
func (m *MockEngine) Close() error
Close mocks base method
func (*MockEngine) EXPECT ¶ added in v0.3.0
func (m *MockEngine) EXPECT() *MockEngineMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockEngine) Finalize ¶ added in v0.3.0
func (m *MockEngine) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (types.Committee, *types.Receipt, error)
Finalize mocks base method
func (*MockEngine) FinalizeAndAssemble ¶ added in v0.3.0
func (m *MockEngine) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts *[]*types.Receipt) (*types.Block, error)
FinalizeAndAssemble mocks base method
func (*MockEngine) Prepare ¶ added in v0.3.0
func (m *MockEngine) Prepare(chain ChainReader, header *types.Header) error
Prepare mocks base method
func (*MockEngine) Seal ¶ added in v0.3.0
func (m *MockEngine) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal mocks base method
func (*MockEngine) SealHash ¶ added in v0.3.0
func (m *MockEngine) SealHash(header *types.Header) common.Hash
SealHash mocks base method
func (*MockEngine) VerifyHeader ¶ added in v0.3.0
func (m *MockEngine) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error
VerifyHeader mocks base method
func (*MockEngine) VerifyHeaders ¶ added in v0.3.0
func (m *MockEngine) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders mocks base method
func (*MockEngine) VerifySeal ¶ added in v0.3.0
func (m *MockEngine) VerifySeal(chain ChainReader, header *types.Header) error
VerifySeal mocks base method
func (*MockEngine) VerifyUncles ¶ added in v0.3.0
func (m *MockEngine) VerifyUncles(chain ChainReader, block *types.Block) error
VerifyUncles mocks base method
type MockEngineMockRecorder ¶ added in v0.3.0
type MockEngineMockRecorder struct {
// contains filtered or unexported fields
}
MockEngineMockRecorder is the mock recorder for MockEngine
func (*MockEngineMockRecorder) APIs ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) APIs(chain interface{}) *gomock.Call
APIs indicates an expected call of APIs
func (*MockEngineMockRecorder) Author ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) Author(header interface{}) *gomock.Call
Author indicates an expected call of Author
func (*MockEngineMockRecorder) CalcDifficulty ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
CalcDifficulty indicates an expected call of CalcDifficulty
func (*MockEngineMockRecorder) Close ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockEngineMockRecorder) Finalize ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
Finalize indicates an expected call of Finalize
func (*MockEngineMockRecorder) FinalizeAndAssemble ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
FinalizeAndAssemble indicates an expected call of FinalizeAndAssemble
func (*MockEngineMockRecorder) Prepare ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) Prepare(chain, header interface{}) *gomock.Call
Prepare indicates an expected call of Prepare
func (*MockEngineMockRecorder) Seal ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
Seal indicates an expected call of Seal
func (*MockEngineMockRecorder) SealHash ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) SealHash(header interface{}) *gomock.Call
SealHash indicates an expected call of SealHash
func (*MockEngineMockRecorder) VerifyHeader ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
VerifyHeader indicates an expected call of VerifyHeader
func (*MockEngineMockRecorder) VerifyHeaders ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
VerifyHeaders indicates an expected call of VerifyHeaders
func (*MockEngineMockRecorder) VerifySeal ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
VerifySeal indicates an expected call of VerifySeal
func (*MockEngineMockRecorder) VerifyUncles ¶ added in v0.3.0
func (mr *MockEngineMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
VerifyUncles indicates an expected call of VerifyUncles
type MockHandler ¶ added in v0.3.0
type MockHandler struct {
// contains filtered or unexported fields
}
MockHandler is a mock of Handler interface
func NewMockHandler ¶ added in v0.3.0
func NewMockHandler(ctrl *gomock.Controller) *MockHandler
NewMockHandler creates a new mock instance
func (*MockHandler) EXPECT ¶ added in v0.3.0
func (m *MockHandler) EXPECT() *MockHandlerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockHandler) NewChainHead ¶ added in v0.3.0
func (m *MockHandler) NewChainHead() error
NewChainHead mocks base method
func (*MockHandler) Protocol ¶ added in v0.3.0
func (m *MockHandler) Protocol() (string, uint64)
Protocol mocks base method
func (*MockHandler) SetBroadcaster ¶ added in v0.3.0
func (m *MockHandler) SetBroadcaster(arg0 Broadcaster)
SetBroadcaster mocks base method
type MockHandlerMockRecorder ¶ added in v0.3.0
type MockHandlerMockRecorder struct {
// contains filtered or unexported fields
}
MockHandlerMockRecorder is the mock recorder for MockHandler
func (*MockHandlerMockRecorder) HandleMsg ¶ added in v0.3.0
func (mr *MockHandlerMockRecorder) HandleMsg(address, data interface{}) *gomock.Call
HandleMsg indicates an expected call of HandleMsg
func (*MockHandlerMockRecorder) NewChainHead ¶ added in v0.3.0
func (mr *MockHandlerMockRecorder) NewChainHead() *gomock.Call
NewChainHead indicates an expected call of NewChainHead
func (*MockHandlerMockRecorder) Protocol ¶ added in v0.3.0
func (mr *MockHandlerMockRecorder) Protocol() *gomock.Call
Protocol indicates an expected call of Protocol
func (*MockHandlerMockRecorder) SetBroadcaster ¶ added in v0.3.0
func (mr *MockHandlerMockRecorder) SetBroadcaster(arg0 interface{}) *gomock.Call
SetBroadcaster indicates an expected call of SetBroadcaster
type MockPeer ¶ added in v0.3.0
type MockPeer struct {
// contains filtered or unexported fields
}
MockPeer is a mock of Peer interface
func NewMockPeer ¶ added in v0.3.0
func NewMockPeer(ctrl *gomock.Controller) *MockPeer
NewMockPeer creates a new mock instance
func (*MockPeer) EXPECT ¶ added in v0.3.0
func (m *MockPeer) EXPECT() *MockPeerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockPeerMockRecorder ¶ added in v0.3.0
type MockPeerMockRecorder struct {
// contains filtered or unexported fields
}
MockPeerMockRecorder is the mock recorder for MockPeer
func (*MockPeerMockRecorder) Send ¶ added in v0.3.0
func (mr *MockPeerMockRecorder) Send(msgcode, data interface{}) *gomock.Call
Send indicates an expected call of Send
type MockPoW ¶ added in v0.3.0
type MockPoW struct {
// contains filtered or unexported fields
}
MockPoW is a mock of PoW interface
func NewMockPoW ¶ added in v0.3.0
func NewMockPoW(ctrl *gomock.Controller) *MockPoW
NewMockPoW creates a new mock instance
func (*MockPoW) APIs ¶ added in v0.3.0
func (m *MockPoW) APIs(chain ChainReader) []rpc.API
APIs mocks base method
func (*MockPoW) CalcDifficulty ¶ added in v0.3.0
CalcDifficulty mocks base method
func (*MockPoW) EXPECT ¶ added in v0.3.0
func (m *MockPoW) EXPECT() *MockPoWMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockPoW) Finalize ¶ added in v0.3.0
func (m *MockPoW) Finalize(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (types.Committee, *types.Receipt, error)
Finalize mocks base method
func (*MockPoW) FinalizeAndAssemble ¶ added in v0.3.0
func (m *MockPoW) FinalizeAndAssemble(chain ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts *[]*types.Receipt) (*types.Block, error)
FinalizeAndAssemble mocks base method
func (*MockPoW) Prepare ¶ added in v0.3.0
func (m *MockPoW) Prepare(chain ChainReader, header *types.Header) error
Prepare mocks base method
func (*MockPoW) Seal ¶ added in v0.3.0
func (m *MockPoW) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal mocks base method
func (*MockPoW) VerifyHeader ¶ added in v0.3.0
VerifyHeader mocks base method
func (*MockPoW) VerifyHeaders ¶ added in v0.3.0
func (m *MockPoW) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders mocks base method
func (*MockPoW) VerifySeal ¶ added in v0.3.0
func (m *MockPoW) VerifySeal(chain ChainReader, header *types.Header) error
VerifySeal mocks base method
func (*MockPoW) VerifyUncles ¶ added in v0.3.0
func (m *MockPoW) VerifyUncles(chain ChainReader, block *types.Block) error
VerifyUncles mocks base method
type MockPoWMockRecorder ¶ added in v0.3.0
type MockPoWMockRecorder struct {
// contains filtered or unexported fields
}
MockPoWMockRecorder is the mock recorder for MockPoW
func (*MockPoWMockRecorder) APIs ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) APIs(chain interface{}) *gomock.Call
APIs indicates an expected call of APIs
func (*MockPoWMockRecorder) Author ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Author(header interface{}) *gomock.Call
Author indicates an expected call of Author
func (*MockPoWMockRecorder) CalcDifficulty ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) CalcDifficulty(chain, time, parent interface{}) *gomock.Call
CalcDifficulty indicates an expected call of CalcDifficulty
func (*MockPoWMockRecorder) Close ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockPoWMockRecorder) Finalize ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Finalize(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
Finalize indicates an expected call of Finalize
func (*MockPoWMockRecorder) FinalizeAndAssemble ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) FinalizeAndAssemble(chain, header, state, txs, uncles, receipts interface{}) *gomock.Call
FinalizeAndAssemble indicates an expected call of FinalizeAndAssemble
func (*MockPoWMockRecorder) Hashrate ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Hashrate() *gomock.Call
Hashrate indicates an expected call of Hashrate
func (*MockPoWMockRecorder) Prepare ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Prepare(chain, header interface{}) *gomock.Call
Prepare indicates an expected call of Prepare
func (*MockPoWMockRecorder) Seal ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) Seal(chain, block, results, stop interface{}) *gomock.Call
Seal indicates an expected call of Seal
func (*MockPoWMockRecorder) SealHash ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) SealHash(header interface{}) *gomock.Call
SealHash indicates an expected call of SealHash
func (*MockPoWMockRecorder) VerifyHeader ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) VerifyHeader(chain, header, seal interface{}) *gomock.Call
VerifyHeader indicates an expected call of VerifyHeader
func (*MockPoWMockRecorder) VerifyHeaders ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) VerifyHeaders(chain, headers, seals interface{}) *gomock.Call
VerifyHeaders indicates an expected call of VerifyHeaders
func (*MockPoWMockRecorder) VerifySeal ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) VerifySeal(chain, header interface{}) *gomock.Call
VerifySeal indicates an expected call of VerifySeal
func (*MockPoWMockRecorder) VerifyUncles ¶ added in v0.3.0
func (mr *MockPoWMockRecorder) VerifyUncles(chain, block interface{}) *gomock.Call
VerifyUncles indicates an expected call of VerifyUncles
type MockSyncer ¶ added in v0.3.0
type MockSyncer struct {
// contains filtered or unexported fields
}
MockSyncer is a mock of Syncer interface
func NewMockSyncer ¶ added in v0.3.0
func NewMockSyncer(ctrl *gomock.Controller) *MockSyncer
NewMockSyncer creates a new mock instance
func (*MockSyncer) EXPECT ¶ added in v0.3.0
func (m *MockSyncer) EXPECT() *MockSyncerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSyncer) ResetPeerCache ¶ added in v0.3.0
func (m *MockSyncer) ResetPeerCache(address common.Address)
ResetPeerCache mocks base method
func (*MockSyncer) SyncPeer ¶ added in v0.3.0
func (m *MockSyncer) SyncPeer(address common.Address)
SyncPeer mocks base method
type MockSyncerMockRecorder ¶ added in v0.3.0
type MockSyncerMockRecorder struct {
// contains filtered or unexported fields
}
MockSyncerMockRecorder is the mock recorder for MockSyncer
func (*MockSyncerMockRecorder) ResetPeerCache ¶ added in v0.3.0
func (mr *MockSyncerMockRecorder) ResetPeerCache(address interface{}) *gomock.Call
ResetPeerCache indicates an expected call of ResetPeerCache
func (*MockSyncerMockRecorder) SyncPeer ¶ added in v0.3.0
func (mr *MockSyncerMockRecorder) SyncPeer(address interface{}) *gomock.Call
SyncPeer indicates an expected call of SyncPeer
type Peer ¶
type Peer interface { // Send sends the message to this peer Send(msgcode uint64, data interface{}) error }
Peer defines the interface to communicate with peer