txpool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTxPoolOptions = Options{
	Limit:           200000,
	LimitPerAccount: 1024,
	MaxLifetime:     20 * time.Minute,
}

Functions

func IsBadTx

func IsBadTx(err error) bool

IsBadTx returns whether the given error indicates that tx is bad.

func IsTxRejected

func IsTxRejected(err error) bool

IsTxRejected returns whether the given error indicates tx is rejected.

Types

type Options

type Options struct {
	Limit           int
	LimitPerAccount int
	MaxLifetime     time.Duration
}

Options options for tx pool.

type TxEvent

type TxEvent struct {
	Tx         cmttypes.Tx
	Executable *bool
}

TxEvent will be posted when tx is added or status changed.

type TxPool

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

TxPool maintains unprocessed transactions.

func New

func New(chain *chain.Chain, options Options) *TxPool

New create a new TxPool instance. Shutdown is required to be called at end.

func (*TxPool) Add

func (p *TxPool) Add(newTx cmttypes.Tx) error

Add add new tx into pool. It's not assumed as an error if the tx to be added is already in the pool,

func (*TxPool) All

func (p *TxPool) All() []*txObject

func (*TxPool) Close

func (p *TxPool) Close()

Close cleanup inner go routines.

func (*TxPool) Dump

func (p *TxPool) Dump() types.Transactions

Dump dumps all txs in the pool.

func (*TxPool) Executables

func (p *TxPool) Executables() types.Transactions

Executables returns executable txs.

func (*TxPool) Fill

func (p *TxPool) Fill(txs types.Transactions, executed func(txID []byte) bool)

Fill fills txs into pool.

func (*TxPool) Get

func (p *TxPool) Get(id []byte) cmttypes.Tx

func (*TxPool) GetNewTxFeed

func (p *TxPool) GetNewTxFeed() chan []byte

func (*TxPool) GetTxObj

func (p *TxPool) GetTxObj(id []byte) *txObject

func (*TxPool) Len

func (p *TxPool) Len() int

func (*TxPool) Remove

func (p *TxPool) Remove(id []byte) bool

Remove removes tx from pool by its ID.

func (*TxPool) StrictlyAdd

func (p *TxPool) StrictlyAdd(newTx cmttypes.Tx) error

StrictlyAdd add new tx into pool. A rejection error will be returned, if tx is not executable at this time.

func (*TxPool) SubscribeTxEvent

func (p *TxPool) SubscribeTxEvent(ch chan *TxEvent) event.Subscription

SubscribeTxEvent receivers will receive a tx

Jump to

Keyboard shortcuts

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