Documentation ¶
Index ¶
- Variables
- type PoolItem
- type TransactionPool
- func (tp *TransactionPool) Clean(currentSlot uint32) []*types.Transaction
- func (tp *TransactionPool) Dump() string
- func (tp *TransactionPool) GasLevel() (glv uint16)
- func (tp *TransactionPool) Get(TxHash hash.Hash256) *PoolItem
- func (tp *TransactionPool) IsExist(TxHash hash.Hash256) bool
- func (tp *TransactionPool) List() []*PoolItem
- func (tp *TransactionPool) Pop(currentSlot uint32) *PoolItem
- func (tp *TransactionPool) Push(TxHash hash.Hash256, tx *types.Transaction, sig common.Signature, ...) error
- func (tp *TransactionPool) Remove(TxHash hash.Hash256, tx *types.Transaction)
- func (tp *TransactionPool) Size() int
- func (tp *TransactionPool) UnsafePop(currentSlot uint32) *PoolItem
- func (tp *TransactionPool) UnsafeSize() int
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyQueue = errors.New("empty queue") ErrNotAccountTransaction = errors.New("not account transaction") ErrExistTransaction = errors.New("exist transaction") ErrTransactionPoolOverflowed = errors.New("transaction pool overflowed") ErrPastSeq = errors.New("past seq") ErrTooFarSeq = errors.New("too far seq") )
TransactionPool errors
Functions ¶
This section is empty.
Types ¶
type PoolItem ¶
type PoolItem struct { TxHash hash.Hash256 Transaction *types.Transaction Signature common.Signature Signer common.Address Slot uint32 }
PoolItem represents the item of the queue
type TransactionPool ¶
TransactionPool provides a transaction queue User can push transaction regardless of UTXO model based transactions or account model based transactions
func NewTransactionPool ¶
func NewTransactionPool() *TransactionPool
NewTransactionPool returns a TransactionPool
func (*TransactionPool) Clean ¶
func (tp *TransactionPool) Clean(currentSlot uint32) []*types.Transaction
Clean removes outdated slot queue
func (*TransactionPool) GasLevel ¶
func (tp *TransactionPool) GasLevel() (glv uint16)
Size returns the size of TxPool
func (*TransactionPool) Get ¶
func (tp *TransactionPool) Get(TxHash hash.Hash256) *PoolItem
Get returns the pool item of the hash
func (*TransactionPool) IsExist ¶
func (tp *TransactionPool) IsExist(TxHash hash.Hash256) bool
IsExist checks that the transaction hash is inserted or not
func (*TransactionPool) List ¶
func (tp *TransactionPool) List() []*PoolItem
List return txpool list
func (*TransactionPool) Pop ¶
func (tp *TransactionPool) Pop(currentSlot uint32) *PoolItem
Pop returns and removes the proper transaction
func (*TransactionPool) Push ¶
func (tp *TransactionPool) Push(TxHash hash.Hash256, tx *types.Transaction, sig common.Signature, signer common.Address) error
Push inserts the transaction and signatures of it by base model An UTXO model based transaction will be handled by FIFO
func (*TransactionPool) Remove ¶
func (tp *TransactionPool) Remove(TxHash hash.Hash256, tx *types.Transaction)
Remove deletes the target transaction from the queue
func (*TransactionPool) Size ¶
func (tp *TransactionPool) Size() int
Size returns the size of TxPool
func (*TransactionPool) UnsafePop ¶
func (tp *TransactionPool) UnsafePop(currentSlot uint32) *PoolItem
UnsafePop returns and removes the proper transaction without mutex locking
func (*TransactionPool) UnsafeSize ¶
func (tp *TransactionPool) UnsafeSize() int
UnsafeSize returns the size of TxPool without mutex