mempool

package
v1.10.17 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 13 Imported by: 4

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

This section is empty.

Functions

This section is empty.

Types

type Mempool

type Mempool interface {
	// we may want to be able to stop valid transactions
	// from entering the mempool, e.g. during blocks creation
	EnableAdding()
	DisableAdding()

	Add(tx *txs.Tx) error
	Has(txID ids.ID) bool
	Get(txID ids.ID) *txs.Tx
	Remove(txs []*txs.Tx)

	// Following Banff activation, all mempool transactions,
	// (both decision and staker) are included into Standard blocks.
	// HasTxs allow to check for availability of any mempool transaction.
	HasTxs() bool
	// PeekTxs returns the next txs for Banff blocks
	// up to maxTxsBytes without removing them from the mempool.
	PeekTxs(maxTxsBytes int) []*txs.Tx

	// Drops all [txs.Staker] transactions whose [StartTime] is before
	// [minStartTime] from [mempool]. The dropped tx ids are returned.
	//
	// TODO: Remove once [StartTime] field is ignored in staker txs
	DropExpiredStakerTxs(minStartTime time.Time) []ids.ID

	// RequestBuildBlock notifies the consensus engine that a block should be
	// built. If [emptyBlockPermitted] is true, the notification will be sent
	// regardless of whether there are no transactions in the mempool. If not,
	// a notification will only be sent if there is at least one transaction in
	// the mempool.
	RequestBuildBlock(emptyBlockPermitted bool)

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

func New added in v1.10.16

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

type MockMempool

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

MockMempool is a mock of Mempool interface.

func NewMockMempool

func NewMockMempool(ctrl *gomock.Controller) *MockMempool

NewMockMempool creates a new mock instance.

func (*MockMempool) Add

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

Add mocks base method.

func (*MockMempool) DisableAdding

func (m *MockMempool) DisableAdding()

DisableAdding mocks base method.

func (*MockMempool) DropExpiredStakerTxs added in v1.10.16

func (m *MockMempool) DropExpiredStakerTxs(arg0 time.Time) []ids.ID

DropExpiredStakerTxs mocks base method.

func (*MockMempool) EXPECT

func (m *MockMempool) EXPECT() *MockMempoolMockRecorder

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

func (*MockMempool) EnableAdding

func (m *MockMempool) EnableAdding()

EnableAdding mocks base method.

func (*MockMempool) Get

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

Get mocks base method.

func (*MockMempool) GetDropReason

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

GetDropReason mocks base method.

func (*MockMempool) Has

func (m *MockMempool) Has(arg0 ids.ID) bool

Has mocks base method.

func (*MockMempool) HasTxs

func (m *MockMempool) HasTxs() bool

HasTxs mocks base method.

func (*MockMempool) MarkDropped

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

MarkDropped mocks base method.

func (*MockMempool) PeekTxs

func (m *MockMempool) PeekTxs(arg0 int) []*txs.Tx

PeekTxs mocks base method.

func (*MockMempool) Remove

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

Remove mocks base method.

func (*MockMempool) RequestBuildBlock added in v1.10.17

func (m *MockMempool) RequestBuildBlock(arg0 bool)

RequestBuildBlock mocks base method.

type MockMempoolMockRecorder

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

MockMempoolMockRecorder is the mock recorder for MockMempool.

func (*MockMempoolMockRecorder) Add

func (mr *MockMempoolMockRecorder) Add(arg0 interface{}) *gomock.Call

Add indicates an expected call of Add.

func (*MockMempoolMockRecorder) DisableAdding

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

DisableAdding indicates an expected call of DisableAdding.

func (*MockMempoolMockRecorder) DropExpiredStakerTxs added in v1.10.16

func (mr *MockMempoolMockRecorder) DropExpiredStakerTxs(arg0 interface{}) *gomock.Call

DropExpiredStakerTxs indicates an expected call of DropExpiredStakerTxs.

func (*MockMempoolMockRecorder) EnableAdding

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

EnableAdding indicates an expected call of EnableAdding.

func (*MockMempoolMockRecorder) Get

func (mr *MockMempoolMockRecorder) Get(arg0 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockMempoolMockRecorder) GetDropReason

func (mr *MockMempoolMockRecorder) GetDropReason(arg0 interface{}) *gomock.Call

GetDropReason indicates an expected call of GetDropReason.

func (*MockMempoolMockRecorder) Has

func (mr *MockMempoolMockRecorder) Has(arg0 interface{}) *gomock.Call

Has indicates an expected call of Has.

func (*MockMempoolMockRecorder) HasTxs

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

HasTxs indicates an expected call of HasTxs.

func (*MockMempoolMockRecorder) MarkDropped

func (mr *MockMempoolMockRecorder) MarkDropped(arg0, arg1 interface{}) *gomock.Call

MarkDropped indicates an expected call of MarkDropped.

func (*MockMempoolMockRecorder) PeekTxs

func (mr *MockMempoolMockRecorder) PeekTxs(arg0 interface{}) *gomock.Call

PeekTxs indicates an expected call of PeekTxs.

func (*MockMempoolMockRecorder) Remove

func (mr *MockMempoolMockRecorder) Remove(arg0 interface{}) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockMempoolMockRecorder) RequestBuildBlock added in v1.10.17

func (mr *MockMempoolMockRecorder) RequestBuildBlock(arg0 interface{}) *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