Documentation ¶
Index ¶
- type TxMempool
- func (t *TxMempool) Get(id types.TransactionID) (*types.Transaction, error)
- func (t *TxMempool) GetProjection(addr types.Address, prevNonce, prevBalance uint64) (nonce, balance uint64)
- func (t *TxMempool) GetTxsByAddress(addr types.Address) []*types.Transaction
- func (t *TxMempool) GetTxsForBlock(numOfTxs int, ...) ([]types.TransactionID, []*types.Transaction, error)
- func (t *TxMempool) Invalidate(id types.TransactionID)
- func (t *TxMempool) Put(id types.TransactionID, tx *types.Transaction)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TxMempool ¶
type TxMempool struct {
// contains filtered or unexported fields
}
TxMempool is a struct that holds txs received via gossip network.
func (*TxMempool) Get ¶
func (t *TxMempool) Get(id types.TransactionID) (*types.Transaction, error)
Get returns transaction by provided id, it returns an error if transaction is not found.
func (*TxMempool) GetProjection ¶
func (t *TxMempool) GetProjection(addr types.Address, prevNonce, prevBalance uint64) (nonce, balance uint64)
GetProjection returns the estimated nonce and balance for the provided address addr and previous nonce and balance projecting state is done by applying transactions from the pool.
func (*TxMempool) GetTxsByAddress ¶
func (t *TxMempool) GetTxsByAddress(addr types.Address) []*types.Transaction
GetTxsByAddress returs all transactions from/to a specific address.
func (*TxMempool) GetTxsForBlock ¶
func (t *TxMempool) GetTxsForBlock(numOfTxs int, getState func(addr types.Address) (nonce, balance uint64, err error)) ([]types.TransactionID, []*types.Transaction, error)
GetTxsForBlock gets a specific number of random txs for a block. This function also receives a state calculation function to allow returning only transactions that will probably be valid.
func (*TxMempool) Invalidate ¶
func (t *TxMempool) Invalidate(id types.TransactionID)
Invalidate removes transaction from pool.
func (*TxMempool) Put ¶
func (t *TxMempool) Put(id types.TransactionID, tx *types.Transaction)
Put inserts a transaction into the mem pool. It indexes it by source and dest addresses as well.