mempool

package
v1.11.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: BSD-3-Clause Imports: 14 Imported by: 8

Documentation

Overview

Package mempool is a generated GoMock package.

Index

Constants

View Source
const (
	// MaxTxSize is the maximum number of bytes a transaction can use to be
	// allowed into the mempool.
	MaxTxSize = 64 * units.KiB
)

Variables

View Source
var (
	ErrDuplicateTx          = errors.New("duplicate tx")
	ErrTxTooLarge           = errors.New("tx too large")
	ErrMempoolFull          = errors.New("mempool is full")
	ErrConflictsWithOtherTx = errors.New("tx conflicts with other tx")
)

Functions

This section is empty.

Types

type Mempool

type Mempool interface {
	Add(tx *txs.Tx) error
	Get(txID ids.ID) (*txs.Tx, bool)
	// Remove [txs] and any conflicts of [txs] from the mempool.
	Remove(txs ...*txs.Tx)

	// Peek returns the oldest tx in the mempool.
	Peek() (tx *txs.Tx, exists bool)

	// Iterate over transactions from oldest to newest until the function
	// returns false or there are no more transactions.
	Iterate(f func(tx *txs.Tx) bool)

	// RequestBuildBlock notifies the consensus engine that a block should be
	// built if there is at least one transaction in the mempool.
	RequestBuildBlock()

	// Note: Dropped txs are added to droppedTxIDs but not evicted from
	// unissued. This allows previously dropped txs to be possibly reissued.
	MarkDropped(txID ids.ID, reason error)
	GetDropReason(txID ids.ID) error

	// Len returns the number of txs in the mempool.
	Len() int
}

Mempool contains transactions that have not yet been put into a block.

func New

func New(
	namespace string,
	registerer prometheus.Registerer,
	toEngine chan<- common.Message,
) (Mempool, error)

type MockMempool added in v1.9.12

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

MockMempool is a mock of Mempool interface.

func NewMockMempool added in v1.9.12

func NewMockMempool(ctrl *gomock.Controller) *MockMempool

NewMockMempool creates a new mock instance.

func (*MockMempool) Add added in v1.9.12

func (m *MockMempool) Add(arg0 *txs.Tx) error

Add mocks base method.

func (*MockMempool) EXPECT added in v1.9.12

func (m *MockMempool) EXPECT() *MockMempoolMockRecorder

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

func (*MockMempool) Get added in v1.9.12

func (m *MockMempool) Get(arg0 ids.ID) (*txs.Tx, bool)

Get mocks base method.

func (*MockMempool) GetDropReason added in v1.9.12

func (m *MockMempool) GetDropReason(arg0 ids.ID) error

GetDropReason mocks base method.

func (*MockMempool) Iterate added in v1.10.18

func (m *MockMempool) Iterate(arg0 func(*txs.Tx) bool)

Iterate mocks base method.

func (*MockMempool) Len added in v1.10.18

func (m *MockMempool) Len() int

Len mocks base method.

func (*MockMempool) MarkDropped added in v1.9.12

func (m *MockMempool) MarkDropped(arg0 ids.ID, arg1 error)

MarkDropped mocks base method.

func (*MockMempool) Peek added in v1.9.12

func (m *MockMempool) Peek() (*txs.Tx, bool)

Peek mocks base method.

func (*MockMempool) Remove added in v1.9.12

func (m *MockMempool) Remove(arg0 ...*txs.Tx)

Remove mocks base method.

func (*MockMempool) RequestBuildBlock added in v1.9.12

func (m *MockMempool) RequestBuildBlock()

RequestBuildBlock mocks base method.

type MockMempoolMockRecorder added in v1.9.12

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

MockMempoolMockRecorder is the mock recorder for MockMempool.

func (*MockMempoolMockRecorder) Add added in v1.9.12

func (mr *MockMempoolMockRecorder) Add(arg0 any) *gomock.Call

Add indicates an expected call of Add.

func (*MockMempoolMockRecorder) Get added in v1.9.12

func (mr *MockMempoolMockRecorder) Get(arg0 any) *gomock.Call

Get indicates an expected call of Get.

func (*MockMempoolMockRecorder) GetDropReason added in v1.9.12

func (mr *MockMempoolMockRecorder) GetDropReason(arg0 any) *gomock.Call

GetDropReason indicates an expected call of GetDropReason.

func (*MockMempoolMockRecorder) Iterate added in v1.10.18

func (mr *MockMempoolMockRecorder) Iterate(arg0 any) *gomock.Call

Iterate indicates an expected call of Iterate.

func (*MockMempoolMockRecorder) Len added in v1.10.18

func (mr *MockMempoolMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len.

func (*MockMempoolMockRecorder) MarkDropped added in v1.9.12

func (mr *MockMempoolMockRecorder) MarkDropped(arg0, arg1 any) *gomock.Call

MarkDropped indicates an expected call of MarkDropped.

func (*MockMempoolMockRecorder) Peek added in v1.9.12

func (mr *MockMempoolMockRecorder) Peek() *gomock.Call

Peek indicates an expected call of Peek.

func (*MockMempoolMockRecorder) Remove added in v1.9.12

func (mr *MockMempoolMockRecorder) Remove(arg0 ...any) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockMempoolMockRecorder) RequestBuildBlock added in v1.9.12

func (mr *MockMempoolMockRecorder) RequestBuildBlock() *gomock.Call

RequestBuildBlock indicates an expected call of RequestBuildBlock.

Jump to

Keyboard shortcuts

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