Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTransactionExists = errors.New("transaction is already in queue")
ErrTransactionExists is returned when trying to add a transaction to the queue that already exists
Functions ¶
This section is empty.
Types ¶
type Item ¶ added in v0.2.0
type Item struct {
// contains filtered or unexported fields
}
An Item is something we manage in a priority queue.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents the transaction pool
func (*Pool) Insert ¶ added in v0.2.0
func (p *Pool) Insert(tx *ValidTransaction) common.Hash
Insert inserts a transaction into the pool
func (*Pool) Transactions ¶ added in v0.2.0
func (p *Pool) Transactions() []*ValidTransaction
Transactions returns all the transactions in the pool
type PriorityQueue ¶
PriorityQueue is a thread safe wrapper over `priorityQueue`
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
NewPriorityQueue creates new instance of PriorityQueue
func (*PriorityQueue) Peek ¶
func (spq *PriorityQueue) Peek() *ValidTransaction
Peek returns the next item without removing it from the queue
func (*PriorityQueue) Pending ¶
func (spq *PriorityQueue) Pending() []*ValidTransaction
Pending returns all the transactions currently in the queue
func (*PriorityQueue) Pop ¶
func (spq *PriorityQueue) Pop() *ValidTransaction
Pop removes the transaction with has the highest priority value from the queue and returns it. If there are multiple transaction with same priority value then it return them in FIFO order.
func (*PriorityQueue) Push ¶
func (spq *PriorityQueue) Push(txn *ValidTransaction) (common.Hash, error)
Push inserts a valid transaction with priority p into the queue
func (*PriorityQueue) RemoveExtrinsic ¶
func (spq *PriorityQueue) RemoveExtrinsic(ext types.Extrinsic)
RemoveExtrinsic removes an extrinsic from the queue
type ValidTransaction ¶
ValidTransaction struct
func NewValidTransaction ¶
func NewValidTransaction(extrinsic types.Extrinsic, validity *Validity) *ValidTransaction
NewValidTransaction returns ValidTransaction
func (*ValidTransaction) Encode ¶
func (vt *ValidTransaction) Encode() ([]byte, error)
Encode SCALE encodes the transaction