api

package
v0.2012.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 3 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
	MaxBatchSize      uint64
	MaxBatchSizeBytes 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 []byte) error

	// AddBatch adds a transaction batch into the transaction pool.
	AddBatch(batch [][]byte) error

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

	// RemoveBatch removes a batch from the transaction pool.
	RemoveBatch(batch [][]byte) 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

	// IsQueue returns true if pool maintains FIFO order of transactions.
	IsQueue() bool

	// 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