mempool

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mempool

type Mempool struct {

	// Pending is a channel of length one, which the mempool ensures has an item on
	// it as long as there is an unissued transaction remaining in [txs]
	Pending chan struct{}
	// contains filtered or unexported fields
}

func New

func New(g *chain.Genesis, maxSize int) *Mempool

New creates a new Mempool. [maxSize] must be > 0 or else the implementation may panic.

func (*Mempool) Add

func (th *Mempool) Add(tx *chain.Transaction) bool

func (*Mempool) Get

func (th *Mempool) Get(id ids.ID) (*chain.Transaction, bool)

func (*Mempool) Has

func (th *Mempool) Has(id ids.ID) bool

func (*Mempool) Len

func (th *Mempool) Len() int

func (*Mempool) NewTxs

func (th *Mempool) NewTxs(maxUnits uint64) []*chain.Transaction

GetNewTxs returns the array of [newTxs] and replaces it with a new array.

func (*Mempool) PeekMax

func (th *Mempool) PeekMax() (*chain.Transaction, uint64)

Assumes there is non-zero items in Mempool

func (*Mempool) PeekMin

func (th *Mempool) PeekMin() (*chain.Transaction, uint64)

Assumes there is non-zero items in Mempool

func (*Mempool) PopMax

func (th *Mempool) PopMax() (*chain.Transaction, uint64)

Assumes there is non-zero items in Mempool

func (*Mempool) PopMin

func (th *Mempool) PopMin() (*chain.Transaction, uint64)

Assumes there is non-zero items in Mempool

func (*Mempool) Prune

func (th *Mempool) Prune(validHashes ids.Set)

Prune removes all transactions that are not found in "validHashes".

func (*Mempool) Remove

func (th *Mempool) Remove(id ids.ID) *chain.Transaction

Jump to

Keyboard shortcuts

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