merkle

package
v0.0.0-...-ac41614 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 6 Imported by: 24

Documentation

Index

Constants

View Source
const MerkleDefaultDepth uint8 = 19
View Source
const MerkleMaxDepth uint8 = 28 // 4GB
View Source
const MerkleMinDepth uint8 = 1

MerkleMaxDepth should never exceed 32

Variables

This section is empty.

Functions

func CountTrailingZeros

func CountTrailingZeros(n uint32) uint32

func LeafNode

func LeafNode(keyHash *Hash, depth uint8) uint32

func NewQueue

func NewQueue(capacity uint32) *queue

func ParentNode

func ParentNode(node uint32) uint32

Types

type MerkleTree

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

func NewDummyMerkleTree

func NewDummyMerkleTree(depth uint8) (*MerkleTree, error)

func NewMerkleTree

func NewMerkleTree(depth uint8) (*MerkleTree, error)

func (*MerkleTree) Depth

func (tree *MerkleTree) Depth() uint8

func (*MerkleTree) IsLeaf

func (tree *MerkleTree) IsLeaf(nodeID uint32) bool

func (*MerkleTree) LeafNode

func (tree *MerkleTree) LeafNode(key []byte) uint32

func (*MerkleTree) LeftChild

func (tree *MerkleTree) LeftChild(node uint32) uint32

func (*MerkleTree) Level

func (tree *MerkleTree) Level(nodeID uint32) uint8

func (*MerkleTree) NodeHash

func (tree *MerkleTree) NodeHash(node uint32) Hash

func (*MerkleTree) NodeLimit

func (tree *MerkleTree) NodeLimit() uint32

func (*MerkleTree) PreviewUpdate

func (tree *MerkleTree) PreviewUpdate(update *Update) (map[uint32]Hash, map[uint32]map[string]Hash)

func (*MerkleTree) RangeHash

func (tree *MerkleTree) RangeHash(rangeMin uint32, rangeMax uint32) Hash

func (*MerkleTree) RightChild

func (tree *MerkleTree) RightChild(node uint32) uint32

func (*MerkleTree) RootHash

func (tree *MerkleTree) RootHash() Hash

func (*MerkleTree) RootNode

func (tree *MerkleTree) RootNode() uint32

func (*MerkleTree) SetNodeHash

func (tree *MerkleTree) SetNodeHash(nodeID uint32, hash Hash)

func (*MerkleTree) SetNodeHashes

func (tree *MerkleTree) SetNodeHashes(nodeHashes map[uint32]Hash)

func (*MerkleTree) SubRangeMax

func (tree *MerkleTree) SubRangeMax(nodeID uint32) uint32

func (*MerkleTree) SubRangeMin

func (tree *MerkleTree) SubRangeMin(nodeID uint32) uint32

func (*MerkleTree) TranslateNode

func (tree *MerkleTree) TranslateNode(nodeID uint32, depth uint8) uint32

func (*MerkleTree) UndoUpdate

func (tree *MerkleTree) UndoUpdate(update *Update)

func (*MerkleTree) Update

func (tree *MerkleTree) Update(update *Update) (map[uint32]bool, map[uint32]map[string]Hash)

func (*MerkleTree) UpdateLeafHash

func (tree *MerkleTree) UpdateLeafHash(nodeID uint32, hash Hash)

this

Jump to

Keyboard shortcuts

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