merkle

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tree

type Tree struct {
	Depth int
	// contains filtered or unexported fields
}

Tree represents a merkle tree with specified depth.

func NewMerkleTree

func NewMerkleTree(hashes ...crypto.Uint256) *Tree

NewMerkleTree returns new merkle tree built on hashes.

func (*Tree) Root

func (m *Tree) Root() *TreeNode

Root returns m's root.

type TreeNode

type TreeNode struct {
	Hash   crypto.Uint256
	Parent *TreeNode
	Left   *TreeNode
	Right  *TreeNode
}

TreeNode represents inner node of a merkle tree.

func (*TreeNode) IsLeaf

func (n *TreeNode) IsLeaf() bool

IsLeaf returns true iff n is a leaf.

func (*TreeNode) IsRoot

func (n *TreeNode) IsRoot() bool

IsRoot returns true iff n is a root.

Jump to

Keyboard shortcuts

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