Documentation ¶
Index ¶
- Variables
- type AccountTransaction
- type PoolItem
- type SeqCache
- type TransactionPool
- func (tp *TransactionPool) IsExist(TxHash hash.Hash256) bool
- func (tp *TransactionPool) Pop(SeqCache SeqCache) *PoolItem
- func (tp *TransactionPool) Push(t transaction.Transaction, sigs []common.Signature) error
- func (tp *TransactionPool) Remove(TxHash hash.Hash256, t transaction.Transaction)
- func (tp *TransactionPool) Size() int
- func (tp *TransactionPool) UnsafePop(SeqCache SeqCache) *PoolItem
- type UTXOTransaction
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyQueue = errors.New("empty queue") ErrNotAccountTransaction = errors.New("not account transaction") ErrExistTransaction = errors.New("exist transaction") )
TransactionPool errors
Functions ¶
This section is empty.
Types ¶
type AccountTransaction ¶
AccountTransaction is an interface that defines common functions of account model based transactions
type PoolItem ¶
type PoolItem struct { Transaction transaction.Transaction TxHash hash.Hash256 Signatures []common.Signature }
PoolItem represents the item of the queue
type SeqCache ¶
SeqCache is an interface that defines the function that acquire the last sequence of the address
type TransactionPool ¶
TransactionPool provides a transaction queue User can push transaction regardless of UTXO model based transactions or account model based transactions If the sequence of the account model based transaction is not reached to the next of the last sequence, it doens't poped
func NewTransactionPool ¶
func NewTransactionPool() *TransactionPool
NewTransactionPool returns a TransactionPool
func (*TransactionPool) IsExist ¶
func (tp *TransactionPool) IsExist(TxHash hash.Hash256) bool
IsExist checks that the transaction hash is inserted or not
func (*TransactionPool) Pop ¶
func (tp *TransactionPool) Pop(SeqCache SeqCache) *PoolItem
Pop returns and removes the proper transaction
func (*TransactionPool) Push ¶
func (tp *TransactionPool) Push(t transaction.Transaction, sigs []common.Signature) error
Push inserts the transaction and signatures of it by base model and sequence An UTXO model based transaction will be handled by FIFO An account model based transaction will be sorted by the sequence value
func (*TransactionPool) Remove ¶
func (tp *TransactionPool) Remove(TxHash hash.Hash256, t transaction.Transaction)
Remove deletes the target transaction from the queue If it is an account model based transaction, it will be sorted by the sequence in the address
func (*TransactionPool) Size ¶
func (tp *TransactionPool) Size() int
Size returns the size of TxPool
func (*TransactionPool) UnsafePop ¶
func (tp *TransactionPool) UnsafePop(SeqCache SeqCache) *PoolItem
UnsafePop returns and removes the proper transaction without mutex locking
type UTXOTransaction ¶
type UTXOTransaction interface {
VinIDs() []uint64
}
UTXOTransaction is an interface that defines common functions of utxo model based transactions