txpool

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ordered = iota
	SortNonce
	Remove
	Rebroadcast
)
View Source
const (
	ReadyGenerateBatch statusType = iota
	HasPendingRequest
	PoolFull
	PoolEmpty
)
View Source
const (
	DefaultPoolSize              = 50000
	DefaultBatchSize             = 500
	DefaultToleranceNonceGap     = 1000
	DefaultToleranceTime         = 5 * time.Minute
	DefaultToleranceRemoveTime   = 15 * time.Minute
	DefaultCleanEmptyAccountTime = 10 * time.Minute
)

nolint

View Source
const (
	SendMissingTxsEvent = iota
	FilterReBroadcastTxsEvent
	RestoreOneBatchEvent
	RestoreAllBatchedEvent
)

=======================consensusEvent=============================

View Source
const (
	DefaultTestBatchSize = uint64(4)
)

nolint

Variables

View Source
var (
	ErrTxPoolFull   = errors.New("tx pool full")
	ErrNonceTooLow  = errors.New("nonce too low")
	ErrNonceTooHigh = errors.New("nonce too high")
	ErrDuplicateTx  = errors.New("duplicate tx")
)

Functions

func NewTxPool

func NewTxPool[T any, Constraint types.TXConstraint[T]](config Config) (txpool.TxPool[T, Constraint], error)

Types

type Config

type Config struct {
	Logger                logrus.FieldLogger
	BatchSize             uint64
	PoolSize              uint64
	BatchMemLimit         bool
	BatchMaxMem           uint64
	IsTimed               bool
	ToleranceNonceGap     uint64
	ToleranceTime         time.Duration
	ToleranceRemoveTime   time.Duration
	CleanEmptyAccountTime time.Duration
	GetAccountNonce       GetAccountNonceFunc
}

Config defines the txpool config items.

func NewMockTxPoolConfig

func NewMockTxPoolConfig() Config

NewMockTxPoolConfig returns the default test config

type GetAccountNonceFunc

type GetAccountNonceFunc func(address string) uint64

type PoolStatusMgr

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

func (*PoolStatusMgr) In

func (st *PoolStatusMgr) In(pos statusType) bool

In returns the atomic status of specified position.

func (*PoolStatusMgr) InOne

func (st *PoolStatusMgr) InOne(poss ...statusType) bool

func (*PoolStatusMgr) Off

func (st *PoolStatusMgr) Off(status ...statusType)

turn off a status

func (*PoolStatusMgr) On

func (st *PoolStatusMgr) On(statusPos ...statusType)

turn on a status

func (*PoolStatusMgr) Reset

func (st *PoolStatusMgr) Reset()

Jump to

Keyboard shortcuts

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