ptrie

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrMissingPath added in v0.10.0

type ErrMissingPath struct {
	Paths []ledger.Path
}

func (ErrMissingPath) Error added in v0.10.0

func (e ErrMissingPath) Error() string

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 (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 ledger.RootHash,
	batchProof *ledger.TrieBatchProof,
) (*PSMT, error)

NewPSMT builds a Partial Sparse Merkle Tree (PSMT) given a chunkdatapack registertouches TODO just accept batch proof as input

func (*PSMT) Get

func (p *PSMT) Get(paths []ledger.Path) ([]*ledger.Payload, error)

Get returns an slice of payloads (same order), an slice of failed paths and errors (if any) TODO return list of indecies instead of paths

func (*PSMT) RootHash

func (p *PSMT) RootHash() ledger.RootHash

RootHash returns the rootNode hash value of the SMT

func (*PSMT) Update

func (p *PSMT) Update(paths []ledger.Path, payloads []*ledger.Payload) (ledger.RootHash, error)

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

type Root

type Root hash.Hash

Root hash of a node

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