pendingtx

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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

func (pt *Handler) Add(txnState *badger.Txn, txs []*objs.Tx, currentHeight uint32) error

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) Delete

func (pt *Handler) Delete(txnState *badger.Txn, txHashes [][]byte) error

Delete removes a list of txHashes from the tx pool

func (*Handler) DeleteMined

func (pt *Handler) DeleteMined(txnState *badger.Txn, currentHeight uint32, txHashes [][]byte) error

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) Drop

func (pt *Handler) Drop() error

Drop deletes all data from the pending tx pool

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL