mtree

package
v0.0.0-...-c598841 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: BSD-4-Clause, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AugData

type AugData struct {
	Min  Counter
	Max  Counter
	Hash smartpool.SPHash
}

func (AugData) Copy

func (ad AugData) Copy() NodeData

func (AugData) CounterBytes

func (ad AugData) CounterBytes() []byte

type AugTree

type AugTree struct {
	MerkleTree
}

func NewAugTree

func NewAugTree() *AugTree

func (AugTree) CounterBranchArray

func (amt AugTree) CounterBranchArray() []*big.Int

func (AugTree) HashBranchArray

func (amt AugTree) HashBranchArray() []*big.Int

func (AugTree) RootHash

func (amt AugTree) RootHash() smartpool.SPHash

func (AugTree) RootMax

func (amt AugTree) RootMax() *big.Int

func (AugTree) RootMin

func (amt AugTree) RootMin() *big.Int

type BranchNode

type BranchNode struct {
	Hash             NodeData
	Left             *BranchNode
	Right            *BranchNode
	ElementOnTheLeft bool
}

func AcceptLeftSibling

func AcceptLeftSibling(b *BranchNode, h NodeData) *BranchNode

explain the operation

func AcceptRightSibling

func AcceptRightSibling(b *BranchNode, h NodeData) *BranchNode

func (BranchNode) ToNodeArray

func (b BranchNode) ToNodeArray() []NodeData

type BranchTree

type BranchTree struct {
	RawData    ElementData
	HashedData NodeData
	Root       *BranchNode
}

func (BranchTree) ToNodeArray

func (t BranchTree) ToNodeArray() []NodeData

type Counter

type Counter interface{}

type DagData

type DagData smartpool.SPHash

func (DagData) Copy

func (dd DagData) Copy() NodeData

type DagTree

type DagTree struct {
	MerkleTree
}

func NewDagTree

func NewDagTree() *DagTree

func (DagTree) AllBranchesArray

func (dt DagTree) AllBranchesArray() []smartpool.BranchElement

return only one array with necessary hashes for each index in order. Element's hash and root are not included eg. registered indexes are 1, 2, each needs 2 hashes then the function return an array of 4 hashes [a1, a2, b1, b2] where a1, a2 are proof branch for element at index 1 b1, b2 are proof branch for element at index 2

func (DagTree) AllDAGElements

func (dt DagTree) AllDAGElements() []smartpool.Word

func (DagTree) MerkleNodes

func (dt DagTree) MerkleNodes() []*big.Int

func (DagTree) RootHash

func (dt DagTree) RootHash() smartpool.SPHash

type ElementData

type ElementData interface{}

type MerkleTree

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

func (MerkleTree) Branches

func (mt MerkleTree) Branches() map[uint32]BranchTree

func (MerkleTree) ExportNodes

func (mt MerkleTree) ExportNodes() []NodeData

func (*MerkleTree) Finalize

func (mt *MerkleTree) Finalize()

func (MerkleTree) Indices

func (mt MerkleTree) Indices() []uint32

func (*MerkleTree) Insert

func (mt *MerkleTree) Insert(data ElementData, index uint32)

func (*MerkleTree) RegisterIndex

func (mt *MerkleTree) RegisterIndex(indexes ...uint32)

register indexes to build branches

func (*MerkleTree) RegisterStoredLevel

func (mt *MerkleTree) RegisterStoredLevel(depth, level uint32)

func (MerkleTree) Root

func (mt MerkleTree) Root() NodeData

func (*MerkleTree) SetElementHashFunction

func (mt *MerkleTree) SetElementHashFunction(_h elementHashFunc)

func (*MerkleTree) SetHashFunction

func (mt *MerkleTree) SetHashFunction(_h hashFunc)

func (*MerkleTree) StoredLevel

func (mt *MerkleTree) StoredLevel() uint32

type NodeData

type NodeData interface {
	Copy() NodeData
}

Jump to

Keyboard shortcuts

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