mtree

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node struct keep data for Merkle tree node. For now, it is binary Merkle tree

func BuildTreeForBlockTx

func BuildTreeForBlockTx(block *types.Block) (*Node, error)

BuildTreeForBlockTx builds Merkle tree from block transactions.

func (*Node) Hash

func (n *Node) Hash() []byte

Hash returns node hash, for leaf node it is hash of associated data object, for not leaf - it calculated for children hashes

func (*Node) Left

func (n *Node) Left() *Node

Left returns left child node for node, if exists

func (*Node) Proof

func (n *Node) Proof(leafIndex int) ([][]byte, error)

Proof calculate intermediate hashes between leaf with given index and root (caller node)

func (*Node) Right

func (n *Node) Right() *Node

Right returns right child node for node, if exists

func (*Node) Sibling

func (n *Node) Sibling() *Node

Sibling returns node sibling - node that has same parent as caller, if exists.

Jump to

Keyboard shortcuts

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