Documentation ¶
Index ¶
- Variables
- type Feer
- type Pool
- func (mp *Pool) Add(t *transaction.Transaction, fee Feer) error
- func (mp *Pool) ContainsKey(hash util.Uint256) bool
- func (mp *Pool) Count() int
- func (mp *Pool) GetVerifiedTransactions() []*transaction.Transaction
- func (mp *Pool) Remove(hash util.Uint256)
- func (mp *Pool) RemoveStale(isOK func(*transaction.Transaction) bool, feer Feer)
- func (mp *Pool) TryGetValue(hash util.Uint256) (*transaction.Transaction, bool)
- func (mp *Pool) Verify(tx *transaction.Transaction, feer Feer) bool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConflict is returned when transaction being added is incompatible // with the contents of the memory pool (Sender doesn't have enough GAS // to pay for all transactions in the pool). ErrConflict = errors.New("conflicts with the memory pool") // ErrDup is returned when transaction being added is already present // in the memory pool. ErrDup = errors.New("already in the memory pool") // ErrOOM is returned when transaction just doesn't fit in the memory // pool because of its capacity constraints. ErrOOM = errors.New("out of memory") )
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool stores the unconfirms transactions.
func (*Pool) Add ¶
func (mp *Pool) Add(t *transaction.Transaction, fee Feer) error
Add tries to add given transaction to the Pool.
func (*Pool) ContainsKey ¶
ContainsKey checks if a transactions hash is in the Pool.
func (*Pool) GetVerifiedTransactions ¶
func (mp *Pool) GetVerifiedTransactions() []*transaction.Transaction
GetVerifiedTransactions returns a slice of transactions with their fees.
func (*Pool) Remove ¶
Remove removes an item from the mempool, if it exists there (and does nothing if it doesn't).
func (*Pool) RemoveStale ¶
func (mp *Pool) RemoveStale(isOK func(*transaction.Transaction) bool, feer Feer)
RemoveStale filters verified transactions through the given function keeping only the transactions for which it returns a true result. It's used to quickly drop part of the mempool that is now invalid after the block acceptance.
func (*Pool) TryGetValue ¶
func (mp *Pool) TryGetValue(hash util.Uint256) (*transaction.Transaction, bool)
TryGetValue returns a transaction and its fee if it exists in the memory pool.
func (*Pool) Verify ¶
func (mp *Pool) Verify(tx *transaction.Transaction, feer Feer) bool
Verify checks if a Sender of tx is able to pay for it (and all the other transactions in the pool). If yes, the transaction tx is a valid transaction and the function returns true. If no, the transaction tx is considered to be invalid the function returns false.