mempool

package
v1.9.10-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: BSD-3-Clause Imports: 9 Imported by: 8

Documentation

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 BlockTimer

type BlockTimer interface {
	// ResetBlockTimer schedules a timer to notify the consensus engine once
	// there is a block ready to be built. If a block is ready to be built when
	// this function is called, the engine will be notified directly.
	ResetBlockTimer()
}

type Mempool

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

	// HasTxs returns true if there is at least one transaction in the mempool.
	HasTxs() bool

	// Peek returns the next first tx that was added to the mempool whose size
	// is less than or equal to maxTxSize.
	Peek(maxTxSize int) *txs.Tx

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

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

func New

func New(
	namespace string,
	registerer prometheus.Registerer,
	blkTimer BlockTimer,
) (Mempool, error)

Jump to

Keyboard shortcuts

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