deposit

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 {
	IsSpent func(txn *badger.Txn, utxoID []byte) (bool, error)
	// contains filtered or unexported fields
}

Handler creates a value owner index of all deposits and allows these deposits to be returned for use in a transaction or for verification.

func (*Handler) Add

func (dp *Handler) Add(txn *badger.Txn, chainID uint32, utxoID []byte, biValue *big.Int, owner *objs.Owner) error

Add will add a deposit to the handler

func (*Handler) Get

func (dp *Handler) Get(txn *badger.Txn, utxoIDs [][]byte) ([]*objs.TXOut, [][]byte, []*objs.TXOut, error)

Get returns four values <found>, <missing>, <spent>, <error> Found returns those deposits that are both known and unspent. Missing returns the utxoIDs of the missing deposits. Spent returns those deposits found that have been spent. An error indicates a failure of the logic and should halt the main.

func (*Handler) GetValueForOwner

func (dp *Handler) GetValueForOwner(txn *badger.Txn, owner *objs.Owner, minValue *uint256.Uint256) ([][]byte, *uint256.Uint256, error)

GetValueForOwner allows a list of utxoIDs to be returned that are equal or greater than the value passed as minValue, and are owned by owner.

func (*Handler) Init

func (dp *Handler) Init() error

Init initializes the deposit handler

func (*Handler) IsValid

func (dp *Handler) IsValid(txn *badger.Txn, txs objs.TxVec) ([]*objs.TXOut, error)

IsValid determines if the deposits in txvec are valid

func (*Handler) Remove

func (dp *Handler) Remove(txn *badger.Txn, utxoID []byte) error

Remove will delete all references to a deposit from the Handler

Jump to

Keyboard shortcuts

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