mempool

package
v0.15.16 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxnPoolFull  = errors.New("transaction pool is full")
	ErrTxnPoolEmpty = errors.New("transaction pool is empty")
)

Functions

func GetHeadValue added in v0.14.4

func GetHeadValue(r db.KeyValueReader) (felt.Felt, error)

func GetLenDB added in v0.14.4

func GetLenDB(r db.KeyValueReader) (int, error)

func GetTailValue added in v0.14.4

func GetTailValue(r db.KeyValueReader) (felt.Felt, error)

func GetTxn added in v0.14.4

func GetTxn(r db.KeyValueReader, txnHash *felt.Felt) (dbPoolTxn, error)

func WriteHeadValue added in v0.14.4

func WriteHeadValue(w db.KeyValueWriter, head *felt.Felt) error

func WriteLenDB added in v0.14.4

func WriteLenDB(w db.KeyValueWriter, l int) error

func WriteTailValue added in v0.14.4

func WriteTailValue(w db.KeyValueWriter, tail *felt.Felt) error

func WriteTxn added in v0.14.4

func WriteTxn(w db.KeyValueWriter, item *dbPoolTxn) error

Types

type BroadcastedTransaction

type BroadcastedTransaction struct {
	Transaction   core.Transaction
	DeclaredClass core.ClassDefinition
	PaidFeeOnL1   *felt.Felt
}

type Pool

type Pool interface {
	Push(context.Context, *BroadcastedTransaction) error
}

type SequencerMempool added in v0.15.1

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

SequencerMempool represents a blockchain mempool, managing transactions using both an in-memory and persistent database.

func New

func New(mainDB db.KeyValueStore, bc blockchain.Reader, maxNumTxns int, log utils.SimpleLogger) *SequencerMempool

New initialises the Pool and starts the database writer goroutine. It is the responsibility of the caller to execute the closer function.

func (*SequencerMempool) Close added in v0.15.1

func (p *SequencerMempool) Close()

func (*SequencerMempool) Len added in v0.15.1

func (p *SequencerMempool) Len() int

Len returns the number of transactions in the in-memory pool

func (*SequencerMempool) LenDB added in v0.15.1

func (p *SequencerMempool) LenDB() (int, error)

func (*SequencerMempool) LoadFromDB added in v0.15.1

func (p *SequencerMempool) LoadFromDB() error

LoadFromDB restores the in-memory transaction pool from the database

func (*SequencerMempool) Pop added in v0.15.1

Pop returns the transaction with the highest priority from the in-memory pool

func (*SequencerMempool) PopBatch added in v0.15.1

func (p *SequencerMempool) PopBatch(numToPop int) ([]BroadcastedTransaction, error)

PopBatch returns a batch of transactions with the highest priority from the in-memory pool

func (*SequencerMempool) Push added in v0.15.1

Push queues a transaction to the pool

func (*SequencerMempool) Remove added in v0.15.1

func (p *SequencerMempool) Remove(hash ...*felt.Felt) error

Remove removes a set of transactions from the pool todo: should be called by the builder to remove txns from the db everytime a new block is stored. todo: in the consensus+p2p world, the txns should also be removed from the in-memory pool.

func (*SequencerMempool) Wait added in v0.15.1

func (p *SequencerMempool) Wait() <-chan struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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