consensustest

package
v0.0.0-...-f5c8f65 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockBroadcaster

type MockBroadcaster struct{}

func (*MockBroadcaster) Enqueue

func (b *MockBroadcaster) Enqueue(id string, block *types.Block)

func (*MockBroadcaster) FindPeers

func (b *MockBroadcaster) FindPeers(targets map[enode.ID]bool, purpose p2p.PurposeFlag) map[enode.ID]consensus.Peer

type MockEngine

type MockEngine struct {
	consensus.Engine
	// contains filtered or unexported fields
}

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) Author

func (e *MockEngine) Author(header *types.Header) (common.Address, error)

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

type MockP2PServer struct {
	Node *enode.Node
}

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

type Mode

type Mode uint
const (
	Fake Mode = iota
	FullFake
)

Jump to

Keyboard shortcuts

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