blockchain

package
v0.0.0-...-d7cfa30 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package blockchain is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	// HasBlock returns if blockchain contains the block corresponding to the block hash.
	HasBlock(context.Context, common.Hash) (bool, error)

	// GetBlockByHash returns the block corresponding to the block hash.
	GetBlockByHash(context.Context, common.Hash) (*types.Block, error)

	// GetBlockByNumber returns the block corresponding to the block height.
	GetBlockByNumber(context.Context, uint64) (*types.Block, error)

	// GetHeaderByHash returns the header corresponding to the block hash.
	GetHeaderByHash(context.Context, common.Hash) (*types.Header, error)

	// GetHeaderByNumber returns the header corresponding to the block height.
	GetHeaderByNumber(context.Context, uint64) (*types.Header, error)

	// GetTransaction gets the transaction for given tx hash.
	GetTransaction(context.Context, common.Hash) (*types.Transaction, common.Hash, uint64, bool, error)

	// GetReceipt gets the receipt for given tx hash.
	GetReceipt(context.Context, common.Hash) (*types.Receipt, common.Hash, uint64, bool, error)

	// GetHead returns the head block.
	GetHead(context.Context) (*types.Block, error)

	// GetHead returns the finalized block.
	GetFinalized(context.Context) (*types.Block, bool, error)

	// GetSafe returns the safe block.
	GetSafe(context.Context) (*types.Block, bool, error)

	// AddBlock adds a *validated* block to the blockchain.
	AddBlock(context.Context, *types.Block, types.Receipts) error

	// SetHead sets the head of the chain.
	SetHead(context.Context, common.Hash) error

	// SetFinalized sets the finalized block of this chain.
	SetFinalized(context.Context, common.Hash) error

	// SetSafe sets the safe block of this chain.
	SetSafe(context.Context, common.Hash) error

	// Shutdown safely shuts the blockchain down.
	Shutdown()
}

func NewBlockchainImpl

func NewBlockchainImpl(ctx context.Context, opts Opts, genesis *core.Genesis) (Blockchain, error)

NewBlockchainImpl creates a new Blockchain.

type MockBlockchain

type MockBlockchain struct {
	// contains filtered or unexported fields
}

MockBlockchain is a mock of Blockchain interface.

func NewMockBlockchain

func NewMockBlockchain(ctrl *gomock.Controller) *MockBlockchain

NewMockBlockchain creates a new mock instance.

func (*MockBlockchain) AddBlock

func (m *MockBlockchain) AddBlock(arg0 context.Context, arg1 *types.Block, arg2 types.Receipts) error

AddBlock mocks base method.

func (*MockBlockchain) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBlockchain) GetBlockByHash

func (m *MockBlockchain) GetBlockByHash(arg0 context.Context, arg1 common.Hash) (*types.Block, error)

GetBlockByHash mocks base method.

func (*MockBlockchain) GetBlockByNumber

func (m *MockBlockchain) GetBlockByNumber(arg0 context.Context, arg1 uint64) (*types.Block, error)

GetBlockByNumber mocks base method.

func (*MockBlockchain) GetFinalized

func (m *MockBlockchain) GetFinalized(arg0 context.Context) (*types.Block, bool, error)

GetFinalized mocks base method.

func (*MockBlockchain) GetHead

func (m *MockBlockchain) GetHead(arg0 context.Context) (*types.Block, error)

GetHead mocks base method.

func (*MockBlockchain) GetHeaderByHash

func (m *MockBlockchain) GetHeaderByHash(arg0 context.Context, arg1 common.Hash) (*types.Header, error)

GetHeaderByHash mocks base method.

func (*MockBlockchain) GetHeaderByNumber

func (m *MockBlockchain) GetHeaderByNumber(arg0 context.Context, arg1 uint64) (*types.Header, error)

GetHeaderByNumber mocks base method.

func (*MockBlockchain) GetReceipt

func (m *MockBlockchain) GetReceipt(arg0 context.Context, arg1 common.Hash) (*types.Receipt, common.Hash, uint64, bool, error)

GetReceipt mocks base method.

func (*MockBlockchain) GetSafe

func (m *MockBlockchain) GetSafe(arg0 context.Context) (*types.Block, bool, error)

GetSafe mocks base method.

func (*MockBlockchain) GetTransaction

func (m *MockBlockchain) GetTransaction(arg0 context.Context, arg1 common.Hash) (*types.Transaction, common.Hash, uint64, bool, error)

GetTransaction mocks base method.

func (*MockBlockchain) HasBlock

func (m *MockBlockchain) HasBlock(arg0 context.Context, arg1 common.Hash) (bool, error)

HasBlock mocks base method.

func (*MockBlockchain) SetFinalized

func (m *MockBlockchain) SetFinalized(arg0 context.Context, arg1 common.Hash) error

SetFinalized mocks base method.

func (*MockBlockchain) SetHead

func (m *MockBlockchain) SetHead(arg0 context.Context, arg1 common.Hash) error

SetHead mocks base method.

func (*MockBlockchain) SetSafe

func (m *MockBlockchain) SetSafe(arg0 context.Context, arg1 common.Hash) error

SetSafe mocks base method.

func (*MockBlockchain) Shutdown

func (m *MockBlockchain) Shutdown()

Shutdown mocks base method.

type MockBlockchainMockRecorder

type MockBlockchainMockRecorder struct {
	// contains filtered or unexported fields
}

MockBlockchainMockRecorder is the mock recorder for MockBlockchain.

func (*MockBlockchainMockRecorder) AddBlock

func (mr *MockBlockchainMockRecorder) AddBlock(arg0, arg1, arg2 any) *gomock.Call

AddBlock indicates an expected call of AddBlock.

func (*MockBlockchainMockRecorder) GetBlockByHash

func (mr *MockBlockchainMockRecorder) GetBlockByHash(arg0, arg1 any) *gomock.Call

GetBlockByHash indicates an expected call of GetBlockByHash.

func (*MockBlockchainMockRecorder) GetBlockByNumber

func (mr *MockBlockchainMockRecorder) GetBlockByNumber(arg0, arg1 any) *gomock.Call

GetBlockByNumber indicates an expected call of GetBlockByNumber.

func (*MockBlockchainMockRecorder) GetFinalized

func (mr *MockBlockchainMockRecorder) GetFinalized(arg0 any) *gomock.Call

GetFinalized indicates an expected call of GetFinalized.

func (*MockBlockchainMockRecorder) GetHead

func (mr *MockBlockchainMockRecorder) GetHead(arg0 any) *gomock.Call

GetHead indicates an expected call of GetHead.

func (*MockBlockchainMockRecorder) GetHeaderByHash

func (mr *MockBlockchainMockRecorder) GetHeaderByHash(arg0, arg1 any) *gomock.Call

GetHeaderByHash indicates an expected call of GetHeaderByHash.

func (*MockBlockchainMockRecorder) GetHeaderByNumber

func (mr *MockBlockchainMockRecorder) GetHeaderByNumber(arg0, arg1 any) *gomock.Call

GetHeaderByNumber indicates an expected call of GetHeaderByNumber.

func (*MockBlockchainMockRecorder) GetReceipt

func (mr *MockBlockchainMockRecorder) GetReceipt(arg0, arg1 any) *gomock.Call

GetReceipt indicates an expected call of GetReceipt.

func (*MockBlockchainMockRecorder) GetSafe

func (mr *MockBlockchainMockRecorder) GetSafe(arg0 any) *gomock.Call

GetSafe indicates an expected call of GetSafe.

func (*MockBlockchainMockRecorder) GetTransaction

func (mr *MockBlockchainMockRecorder) GetTransaction(arg0, arg1 any) *gomock.Call

GetTransaction indicates an expected call of GetTransaction.

func (*MockBlockchainMockRecorder) HasBlock

func (mr *MockBlockchainMockRecorder) HasBlock(arg0, arg1 any) *gomock.Call

HasBlock indicates an expected call of HasBlock.

func (*MockBlockchainMockRecorder) SetFinalized

func (mr *MockBlockchainMockRecorder) SetFinalized(arg0, arg1 any) *gomock.Call

SetFinalized indicates an expected call of SetFinalized.

func (*MockBlockchainMockRecorder) SetHead

func (mr *MockBlockchainMockRecorder) SetHead(arg0, arg1 any) *gomock.Call

SetHead indicates an expected call of SetHead.

func (*MockBlockchainMockRecorder) SetSafe

func (mr *MockBlockchainMockRecorder) SetSafe(arg0, arg1 any) *gomock.Call

SetSafe indicates an expected call of SetSafe.

func (*MockBlockchainMockRecorder) Shutdown

func (mr *MockBlockchainMockRecorder) Shutdown() *gomock.Call

Shutdown indicates an expected call of Shutdown.

type Opts

type Opts struct {
	// Path to the data store
	Path string

	// Max block to retain
	MaxBlockToRetain uint64

	// The pruning frequency
	PruningFrequency uint64

	// The IO Timeout
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Opts is the options for blockchain.

Jump to

Keyboard shortcuts

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