Documentation ¶
Index ¶
- type MockBroadcaster
- type MockEngine
- func (e *MockEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (e *MockEngine) Author(header *types.Header) (common.Address, error)
- func (e *MockEngine) Close() error
- func (e *MockEngine) EpochSize() uint64
- func (e *MockEngine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, ...)
- func (e *MockEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, ...) (*types.Block, error)
- func (e *MockEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error
- func (e *MockEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block) error
- func (e *MockEngine) SetCallBacks(hasBadBlock func(common.Hash) bool, ...) error
- func (e *MockEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
- func (e *MockEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (e *MockEngine) VerifySeal(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 MockPeer
- 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.ChainHeaderReader) []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.ChainHeaderReader, header *types.Header, statedb *state.StateDB, txs []*types.Transaction)
func (*MockEngine) FinalizeAndAssemble ¶
func (e *MockEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, 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.ChainHeaderReader, header *types.Header) error
func (*MockEngine) Seal ¶
func (e *MockEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block) error
func (*MockEngine) SetCallBacks ¶
func (e *MockEngine) SetCallBacks(hasBadBlock func(common.Hash) bool, processBlock func(*types.Block, *state.StateDB) (types.Receipts, []*types.Log, uint64, error), validateState func(*types.Block, *state.StateDB, types.Receipts, uint64) error, onNewConsensusBlock func(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB)) error
SetCallBacks sets call back functions
func (*MockEngine) VerifyHeader ¶
func (e *MockEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
func (*MockEngine) VerifyHeaders ¶
func (e *MockEngine) VerifyHeaders(chain consensus.ChainHeaderReader, 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(header *types.Header) error
type MockP2PServer ¶
func NewMockP2PServer ¶
func NewMockP2PServer(pubKey *ecdsa.PublicKey) *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
type MockPeer ¶
type MockPeer struct {
// contains filtered or unexported fields
}
func NewMockPeer ¶
func NewMockPeer(node *enode.Node, purposes p2p.PurposeFlag) *MockPeer
func (*MockPeer) PurposeIsSet ¶
func (mp *MockPeer) PurposeIsSet(purpose p2p.PurposeFlag) bool