utxotrie

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCanonicalStateRoot

func GetCanonicalStateRoot(txn *badger.Txn) ([]byte, error)

func GetCurrentStateRoot

func GetCurrentStateRoot(txn *badger.Txn) ([]byte, error)

func GetPendingStateRoot

func GetPendingStateRoot(txn *badger.Txn) ([]byte, error)

func SetCanonicalStateRoot

func SetCanonicalStateRoot(txn *badger.Txn, root []byte) error

func SetCurrentStateRoot

func SetCurrentStateRoot(txn *badger.Txn, root []byte) error

func SetPendingStateRoot

func SetPendingStateRoot(txn *badger.Txn, root []byte) error

Types

type UTXOTrie

type UTXOTrie struct {
	DB *badger.DB
	// contains filtered or unexported fields
}

UTXOTrie stores the active UTXO set. There are two types of entries in the utxoTrie. The first type is a standard UTXO. These entries are stored at the location of the UTXOID with the value equal to the preHash of the UTXO. The second type is the deposit entry. These are stored at the location of the Nonce of the deposit with the value equal to the PreHash of the Deposit. In order to spend a UTXO it must be present in the trie. In order to spend a deposit it MUST NOT be in the trie.

func NewUTXOTrie

func NewUTXOTrie(db *badger.DB) *UTXOTrie

NewUTXOTrie ...

func (*UTXOTrie) ApplyState

func (ut *UTXOTrie) ApplyState(txn *badger.Txn, txs aobjs.TxVec, height uint32) ([]byte, error)

func (*UTXOTrie) Contains

func (ut *UTXOTrie) Contains(txn *badger.Txn, utxoIDs [][]byte) ([][]byte, error)

func (*UTXOTrie) FinalizeSnapShotRoot

func (ut *UTXOTrie) FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error

func (*UTXOTrie) Get

func (ut *UTXOTrie) Get(txn *badger.Txn, utxoIDs [][]byte) ([][]byte, [][]byte, error)

func (*UTXOTrie) GetCanonicalTrie

func (ut *UTXOTrie) GetCanonicalTrie(txn *badger.Txn) (*trie.SMT, error)

func (*UTXOTrie) GetCurrentStateRoot

func (ut *UTXOTrie) GetCurrentStateRoot(txn *badger.Txn) ([]byte, error)

func (*UTXOTrie) GetCurrentTrie

func (ut *UTXOTrie) GetCurrentTrie(txn *badger.Txn) (*trie.SMT, error)

func (*UTXOTrie) GetPendingTrie

func (ut *UTXOTrie) GetPendingTrie(txn *badger.Txn) (*trie.SMT, error)

func (*UTXOTrie) GetSnapShotNode

func (ut *UTXOTrie) GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error)

func (*UTXOTrie) GetStateRootForProposal

func (ut *UTXOTrie) GetStateRootForProposal(txn *badger.Txn, txs aobjs.TxVec) ([]byte, error)

func (*UTXOTrie) Init

func (ut *UTXOTrie) Init(_ uint32) error

func (*UTXOTrie) StoreSnapShotNode

func (ut *UTXOTrie) StoreSnapShotNode(txn *badger.Txn, batch []byte, root []byte, layer int) ([][]byte, int, []trie.LeafNode, error)

Jump to

Keyboard shortcuts

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