mock

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const MockInsertAsInitialCycle = false

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSentry

type MockSentry struct {
	proto_sentry.UnimplementedSentryServer
	Ctx context.Context
	Log log.Logger

	DB     kv.RwDB
	Dirs   datadir.Dirs
	Engine consensus.Engine

	ChainConfig   *chain.Config
	Sync          *stagedsync.Sync
	MiningSync    *stagedsync.Sync
	PendingBlocks chan *types.Block
	MinedBlocks   chan *types.Block

	Key          *ecdsa.PrivateKey
	Genesis      *types.Block
	SentryClient direct.SentryClient
	PeerId       *ptypes.H512
	UpdateHead   func(Ctx context.Context, headHeight, headTime uint64, hash libcommon.Hash, td *uint256.Int)

	StreamWg             sync.WaitGroup
	ReceiveWg            sync.WaitGroup
	Address              libcommon.Address
	Eth1ExecutionService *eth1.EthereumExecutionModule

	Notifications *shards.Notifications

	// TxPool
	TxPoolFetch      *txpool.Fetch
	TxPoolSend       *txpool.Send
	TxPoolGrpcServer *txpool.GrpcServer
	TxPool           *txpool.TxPool

	HistoryV3 bool

	BlockSnapshots *freezeblocks.RoSnapshots
	BlockReader    services.FullBlockReader
	// contains filtered or unexported fields
}

func Mock

func Mock(tb testing.TB) *MockSentry

Mock is convenience function to create a mock with some pre-set values

func MockWithEverything

func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateKey, prune prune.Mode,
	engine consensus.Engine, blockBufferSize int, withTxPool, withPosDownloader, checkStateRoot bool,
) *MockSentry

func MockWithGenesis

func MockWithGenesis(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateKey, withPosDownloader bool) *MockSentry

func MockWithGenesisEngine

func MockWithGenesisEngine(tb testing.TB, gspec *types.Genesis, engine consensus.Engine, withPosDownloader, checkStateRoot bool) *MockSentry

func MockWithGenesisPruneMode

func MockWithGenesisPruneMode(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateKey, blockBufferSize int, prune prune.Mode, withPosDownloader bool) *MockSentry

func MockWithTxPool

func MockWithTxPool(t *testing.T) *MockSentry

func MockWithZeroTTD

func MockWithZeroTTD(t *testing.T, withPosDownloader bool) *MockSentry

func MockWithZeroTTDGnosis

func MockWithZeroTTDGnosis(t *testing.T, withPosDownloader bool) *MockSentry

func (*MockSentry) BlocksIO

func (*MockSentry) CalcStateRoot

func (ms *MockSentry) CalcStateRoot(tx kv.Tx) libcommon.Hash

func (*MockSentry) Close

func (ms *MockSentry) Close()

func (*MockSentry) EnableLogs

func (ms *MockSentry) EnableLogs()

func (*MockSentry) HandShake

func (*MockSentry) HeaderDownload

func (ms *MockSentry) HeaderDownload() *headerdownload.HeaderDownload

func (*MockSentry) HistoryV3Components

func (ms *MockSentry) HistoryV3Components() *libstate.AggregatorV3

func (*MockSentry) InsertChain

func (ms *MockSentry) InsertChain(chain *core.ChainPack) error

func (*MockSentry) Messages

func (*MockSentry) NewHistoryStateReader

func (ms *MockSentry) NewHistoryStateReader(blockNum uint64, tx kv.Tx) state.StateReader

func (*MockSentry) NewStateReader

func (ms *MockSentry) NewStateReader(tx kv.Tx) state.StateReader

func (*MockSentry) NewStateWriter

func (ms *MockSentry) NewStateWriter(tx kv.RwTx, blockNum uint64) state.StateWriter

func (*MockSentry) NodeInfo

func (*MockSentry) PeerEvents

func (*MockSentry) PeerMinBlock

func (*MockSentry) Peers

func (*MockSentry) PenalizePeer

func (*MockSentry) Send

func (ms *MockSentry) Send(req *proto_sentry.InboundMessage) (errs []error)

Stream returns stream, waiting if necessary

func (*MockSentry) SendMessageById

func (*MockSentry) SendMessageToAll

func (*MockSentry) SentMessage

func (ms *MockSentry) SentMessage(i int) *proto_sentry.OutboundMessageData

Jump to

Keyboard shortcuts

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