api

package
v0.2103.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package api defines the transaction pool interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCallAlreadyExists = fmt.Errorf("call already exists in pool")
	ErrFull              = fmt.Errorf("pool is full")
	ErrCallTooLarge      = p2pError.Permanent(fmt.Errorf("call too large"))
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxPoolSize uint64

	WeightLimits map[transaction.Weight]uint64
}

Config is a transaction pool configuration.

type TxPool

type TxPool interface {
	// Name is the transaction pool implementation name.
	Name() string

	// Add adds a single transaction into the transaction pool.
	Add(tx *transaction.CheckedTransaction) error

	// GetBatch gets a transaction batch from the transaction pool.
	GetBatch(force bool) []*transaction.CheckedTransaction

	// RemoveBatch removes a batch from the transaction pool.
	RemoveBatch(batch []hash.Hash) error

	// IsQueued returns whether a transaction is in the queue already.
	IsQueued(txHash hash.Hash) bool

	// Size returns the number of transactions in the transaction pool.
	Size() uint64

	// UpdateConfig updates the transaction pool config.
	UpdateConfig(Config) error

	// Clear clears the transaction pool.
	Clear()
}

TxPool is the transaction pool interface.

Jump to

Keyboard shortcuts

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