Documentation
¶
Index ¶
- Variables
- func GetHeadValue(r db.KeyValueReader) (felt.Felt, error)
- func GetLenDB(r db.KeyValueReader) (int, error)
- func GetTailValue(r db.KeyValueReader) (felt.Felt, error)
- func GetTxn(r db.KeyValueReader, txnHash *felt.Felt) (dbPoolTxn, error)
- func WriteHeadValue(w db.KeyValueWriter, head *felt.Felt) error
- func WriteLenDB(w db.KeyValueWriter, l int) error
- func WriteTailValue(w db.KeyValueWriter, tail *felt.Felt) error
- func WriteTxn(w db.KeyValueWriter, item *dbPoolTxn) error
- type BroadcastedTransaction
- type Pool
- type SequencerMempool
- func (p *SequencerMempool) Close()
- func (p *SequencerMempool) Len() int
- func (p *SequencerMempool) LenDB() (int, error)
- func (p *SequencerMempool) LoadFromDB() error
- func (p *SequencerMempool) Pop() (BroadcastedTransaction, error)
- func (p *SequencerMempool) PopBatch(numToPop int) ([]BroadcastedTransaction, error)
- func (p *SequencerMempool) Push(ctx context.Context, userTxn *BroadcastedTransaction) error
- func (p *SequencerMempool) Remove(hash ...*felt.Felt) error
- func (p *SequencerMempool) Wait() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
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 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 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
func (p *SequencerMempool) Pop() (BroadcastedTransaction, error)
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
func (p *SequencerMempool) Push(ctx context.Context, userTxn *BroadcastedTransaction) error
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{}