ptrie

package
v0.10.1-consensus-desr... Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PSMT

type PSMT struct {
	// contains filtered or unexported fields
}

PSMT (Partial Sparse Merkle Tree) holds a subset of an sparse merkle tree at specific state commitment (no historic views). Instead of keeping any unneeded branch, it only keeps the hash of subtree. This implementation is fully stored in memory and doesn't use a database.

DEFINITIONS and CONVENTIONS:

  • HEIGHT of a node v in a tree is the number of edges on the longest downward path between v and a tree leaf. The height of a tree is the heights of its root. The height of a Trie is always the height of the fully-expanded tree.

func NewPSMT

func NewPSMT(
	rootValue []byte,
	keyByteSize int,
	keys [][]byte,
	values [][]byte,
	proofs [][]byte,
) (*PSMT, error)

NewPSMT builds a Partial Sparse Merkle Tree (PMST) given a chunkdatapack registertouches

func (*PSMT) KeySize

func (p *PSMT) KeySize() int

KeySize returns the expected expected size bytes of register key

func (*PSMT) RootHash

func (p *PSMT) RootHash() []byte

GetRootHash returns the rootNode value of the SMT

func (*PSMT) Update

func (p *PSMT) Update(registerIDs [][]byte, values [][]byte) ([]byte, []string, error)

Update updates the register values and returns rootValue after updates in case of error, it returns a list of keys for which update failed

type Root

type Root []byte

func (Root) String

func (r Root) String() string

Jump to

Keyboard shortcuts

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