Documentation ¶
Index ¶
- type Handler
- func (pt *Handler) Add(txnState *badger.Txn, txs []*objs.Tx, currentHeight uint32) error
- func (pt *Handler) Contains(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) ([][]byte, error)
- func (pt *Handler) Delete(txnState *badger.Txn, txHashes [][]byte) error
- func (pt *Handler) DeleteMined(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) error
- func (pt *Handler) Drop() error
- func (pt *Handler) Get(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) ([]*objs.Tx, [][]byte, error)
- func (pt *Handler) GetTxsForGossip(txnState *badger.Txn, ctx context.Context, currentHeight uint32, ...) ([]*objs.Tx, error)
- func (pt *Handler) GetTxsForProposal(txnState *badger.Txn, ctx context.Context, currentHeight uint32, ...) (objs.TxVec, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { UTXOHandler utxoHandler DepositHandler depositHandler // contains filtered or unexported fields }
Handler is the object that acts as the pending tx pool
func NewPendingTxHandler ¶
func NewPendingTxHandler(db *badger.DB) *Handler
NewPendingTxHandler creates a new Handler object
func (*Handler) Add ¶
Add stores a tx in the tx pool and possibly evicts other txs if the ref counting of utxo consumers requires it.
func (*Handler) Contains ¶
func (pt *Handler) Contains(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) ([][]byte, error)
Contains returns a list of missing transactions when a list of tx hashes is passed in
func (*Handler) DeleteMined ¶
DeleteMined removes all specified transactions from the pool as well as any other transactions that reference a consumed UTXO from the set of passed in transactions
func (*Handler) Get ¶
func (pt *Handler) Get(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) ([]*objs.Tx, [][]byte, error)
Get returns a list of txs based on txHashes and a list of all txHashes that could not be found
func (*Handler) GetTxsForGossip ¶
func (pt *Handler) GetTxsForGossip(txnState *badger.Txn, ctx context.Context, currentHeight uint32, maxBytes uint32) ([]*objs.Tx, error)
GetTxsForGossip returns the oldest non-expired and non-consumed txs from the tx pool. These txs may be conflicting in terms of consumed UTXOS.
func (*Handler) GetTxsForProposal ¶
func (pt *Handler) GetTxsForProposal(txnState *badger.Txn, ctx context.Context, currentHeight uint32, maxBytes uint32, tx *objs.Tx) (objs.TxVec, error)
GetTxsForProposal returns an set of txs that are mutually exclusive with respect to the consumed UTXOs. This is used to genrete new proposals.