Documentation ¶
Index ¶
- type UTXOHandler
- func (ut *UTXOHandler) ApplyState(txn *badger.Txn, txs objs.TxVec, height uint32) ([]byte, error)
- func (ut *UTXOHandler) Contains(txn *badger.Txn, utxoID []byte) (bool, error)
- func (ut *UTXOHandler) FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error
- func (ut *UTXOHandler) Get(txn *badger.Txn, utxoIDs [][]byte) ([]*objs.TXOut, [][]byte, error)
- func (ut *UTXOHandler) GetData(txn *badger.Txn, owner *objs.Owner, dataIdx []byte) ([]byte, error)
- func (ut *UTXOHandler) GetExpiredForProposal(txn *badger.Txn, ctx context.Context, chainID, height uint32, ...) (*objs.Tx, error)
- func (ut *UTXOHandler) GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error)
- func (ut *UTXOHandler) GetStateRootForProposal(txn *badger.Txn, txs objs.TxVec) ([]byte, error)
- func (ut *UTXOHandler) GetValueForOwner(txn *badger.Txn, owner *objs.Owner, minValue *uint256.Uint256) ([][]byte, *uint256.Uint256, error)
- func (ut *UTXOHandler) Init(height uint32) error
- func (ut *UTXOHandler) IsValid(txn *badger.Txn, txs objs.TxVec, currentHeight uint32, deposits objs.Vout) (objs.Vout, error)
- func (ut *UTXOHandler) PaginateDataByOwner(txn *badger.Txn, owner *objs.Owner, currentHeight uint32, numItems int, ...) ([]*objs.PaginationResponse, error)
- func (ut *UTXOHandler) StoreSnapShotNode(txn *badger.Txn, batch []byte, root []byte, layer int) ([][]byte, int, []trie.LeafNode, error)
- func (ut *UTXOHandler) StoreSnapShotStateData(txn *badger.Txn, utxoID []byte, preHash []byte, utxoBytes []byte) error
- func (ut *UTXOHandler) TrieContains(txn *badger.Txn, utxoID []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UTXOHandler ¶
type UTXOHandler struct {
// contains filtered or unexported fields
}
UTXOHandler is the object that indexes and stores UTXOs. This object also manages the UTXOTrie.
func NewUTXOHandler ¶
func NewUTXOHandler(dB *badger.DB) *UTXOHandler
NewUTXOHandler constructs a new UTXOHandler
func (*UTXOHandler) ApplyState ¶
ApplyState will update the state trie with the given proposal data. Consumed UTXOs will be deleted from the trie. New UTXOs will be added to the trie. Consumed deposits will be added to the trie.
func (*UTXOHandler) Contains ¶
func (ut *UTXOHandler) Contains(txn *badger.Txn, utxoID []byte) (bool, error)
Contains returns if a UTXO is stored in storage.
func (*UTXOHandler) FinalizeSnapShotRoot ¶
func (ut *UTXOHandler) FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error
func (*UTXOHandler) GetData ¶
GetData returns the data stored in a utxo by owner and the data index.
func (*UTXOHandler) GetExpiredForProposal ¶
func (ut *UTXOHandler) GetExpiredForProposal(txn *badger.Txn, ctx context.Context, chainID, height uint32, curveSpec constants.CurveSpec, signer objs.Signer, maxBytes uint32) (*objs.Tx, error)
GetExpiredForProposal returns a list of UTXOs, the IDs of those UTXOs, and the total byte count of the returned UTXOs. This is used to collect expired dataStores for deletion.
func (*UTXOHandler) GetSnapShotNode ¶
func (ut *UTXOHandler) GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error)
func (*UTXOHandler) GetStateRootForProposal ¶
func (ut *UTXOHandler) GetStateRootForProposal(txn *badger.Txn, txs objs.TxVec) ([]byte, error)
GetStateRootForProposal allows a new stateRoot to be calculated for a proposal without committing the changes to the trie.
func (*UTXOHandler) GetValueForOwner ¶
func (ut *UTXOHandler) 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 (*UTXOHandler) Init ¶
func (ut *UTXOHandler) Init(height uint32) error
Init will initialize the UTXOHandler
func (*UTXOHandler) IsValid ¶
func (ut *UTXOHandler) IsValid(txn *badger.Txn, txs objs.TxVec, currentHeight uint32, deposits objs.Vout) (objs.Vout, error)
IsValid verifies the rules of batches across transactions as is generated in a block
func (*UTXOHandler) PaginateDataByOwner ¶
func (ut *UTXOHandler) PaginateDataByOwner(txn *badger.Txn, owner *objs.Owner, currentHeight uint32, numItems int, startIndex []byte) ([]*objs.PaginationResponse, error)
PaginateDataByOwner ...
func (*UTXOHandler) StoreSnapShotNode ¶
func (*UTXOHandler) StoreSnapShotStateData ¶
func (ut *UTXOHandler) StoreSnapShotStateData(txn *badger.Txn, utxoID []byte, preHash []byte, utxoBytes []byte) error
func (*UTXOHandler) TrieContains ¶
func (ut *UTXOHandler) TrieContains(txn *badger.Txn, utxoID []byte) (bool, error)
TrieContains allows a utxoID to be referenced in the trie. If the trie contains the utxoID, the result will be true, nil.