Documentation ¶
Index ¶
- type MockBroadcaster
- type MockEngine
- func (e *MockEngine) APIs(chain consensus.ChainReader) []rpc.API
- func (e *MockEngine) Author(header *types.Header) (common.Address, error)
- func (e *MockEngine) Close() error
- func (e *MockEngine) Finalize(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, ...)
- func (e *MockEngine) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, ...) (*types.Block, error)
- func (e *MockEngine) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (e *MockEngine) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (e *MockEngine) SealHash(header *types.Header) (hash common.Hash)
- func (e *MockEngine) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (e *MockEngine) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (e *MockEngine) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- type MockP2PServer
- func (serv *MockP2PServer) AddPeer(node *enode.Node, purpose p2p.PurposeFlag)
- func (serv *MockP2PServer) AddTrustedPeer(node *enode.Node, purpose p2p.PurposeFlag)
- func (serv *MockP2PServer) RemovePeer(node *enode.Node, purpose p2p.PurposeFlag)
- func (serv *MockP2PServer) RemoveTrustedPeer(node *enode.Node, purpose p2p.PurposeFlag)
- func (serv *MockP2PServer) Self() *enode.Node
- type Mode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockBroadcaster ¶
type MockBroadcaster struct{}
type MockEngine ¶
MockEngine provides a minimal fake implementation of a consensus engine for use in blockchain tests.
func NewFakeDelayer ¶
func NewFakeDelayer(delay time.Duration) *MockEngine
NewFakeDelayer creates a MockEngine consensus engine that accepts all blocks as valid, but delays verifications by some time, though they still have to conform to the Ethereum consensus rules.
func NewFakeFailer ¶
func NewFakeFailer(blockNumber uint64) *MockEngine
NewFakeFailer creates a MockEngine consensus engine that accepts all blocks as valid apart from the single one specified, though they still have to conform to the Ethereum consensus rules.
func NewFaker ¶
func NewFaker() *MockEngine
NewFaker creates a MockEngine consensus engine that accepts all blocks' seal as valid, though they still have to conform to the Ethereum consensus rules.
func NewFullFaker ¶
func NewFullFaker() *MockEngine
NewFullFaker creates an MockEngine consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.
func (*MockEngine) APIs ¶
func (e *MockEngine) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs.
func (*MockEngine) Close ¶
func (e *MockEngine) Close() error
Close closes the exit channel to notify all backend threads exiting.
func (*MockEngine) Finalize ¶
func (e *MockEngine) Finalize(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, txs []*types.Transaction)
func (*MockEngine) FinalizeAndAssemble ¶
func (e *MockEngine) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt, randomness *types.Randomness) (*types.Block, error)
func (*MockEngine) Prepare ¶
func (e *MockEngine) Prepare(chain consensus.ChainReader, header *types.Header) error
func (*MockEngine) Seal ¶
func (e *MockEngine) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
func (*MockEngine) SealHash ¶
func (e *MockEngine) SealHash(header *types.Header) (hash common.Hash)
SealHash returns the hash of a block prior to it being sealed.
func (*MockEngine) VerifyHeader ¶
func (e *MockEngine) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
func (*MockEngine) VerifyHeaders ¶
func (e *MockEngine) 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.
func (*MockEngine) VerifySeal ¶
func (e *MockEngine) VerifySeal(chain consensus.ChainReader, header *types.Header) error
type MockP2PServer ¶
func NewMockP2PServer ¶
func NewMockP2PServer() *MockP2PServer
func (*MockP2PServer) AddPeer ¶
func (serv *MockP2PServer) AddPeer(node *enode.Node, purpose p2p.PurposeFlag)
func (*MockP2PServer) AddTrustedPeer ¶
func (serv *MockP2PServer) AddTrustedPeer(node *enode.Node, purpose p2p.PurposeFlag)
func (*MockP2PServer) RemovePeer ¶
func (serv *MockP2PServer) RemovePeer(node *enode.Node, purpose p2p.PurposeFlag)
func (*MockP2PServer) RemoveTrustedPeer ¶
func (serv *MockP2PServer) RemoveTrustedPeer(node *enode.Node, purpose p2p.PurposeFlag)
func (*MockP2PServer) Self ¶
func (serv *MockP2PServer) Self() *enode.Node