mmr

package
v0.4.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ValueSize = 40

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Hash   chainhash.Hash
	Weight uint64
	// contains filtered or unexported fields
}

func BuildMerkleTreeStore

func BuildMerkleTreeStore(blocks []Block) []*Block

func HashMerkleBranches

func HashMerkleBranches(left, right *Block) *Block

func (*Block) Value

func (b *Block) Value() Value

type BlockNode

type BlockNode struct {
	Block
	// ActualRoot is a root of the MMR Tree when this node was latest
	ActualRoot chainhash.Hash
	// PrevNode hash of previous block
	PrevNode *BlockNode
	// ID of node in the MMR Tree
	ID uint32
	// contains filtered or unexported fields
}

type BlocksMMRTree

type BlocksMMRTree interface {
	Current() *BlockNode
	Parent(height int32) *BlockNode
	Block(height int32) *BlockNode
	CurrentRoot() chainhash.Hash
	RootForHeight(height int32) chainhash.Hash

	LookupNodeByRoot(chainhash.Hash) *BlockNode

	AddBlock(hash chainhash.Hash, difficulty uint64, height int32)
	RmBlock(hash chainhash.Hash, height int32)
}

type Tree

type Tree struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTree

func NewTree() *Tree

func (*Tree) AddBlock

func (t *Tree) AddBlock(hash chainhash.Hash, difficulty uint64, height int32)

func (*Tree) Block

func (t *Tree) Block(height int32) *BlockNode

func (*Tree) Current

func (t *Tree) Current() *BlockNode

func (*Tree) CurrentRoot

func (t *Tree) CurrentRoot() chainhash.Hash

func (*Tree) LookupNodeByRoot

func (t *Tree) LookupNodeByRoot(hash chainhash.Hash) *BlockNode

func (*Tree) Parent

func (t *Tree) Parent(height int32) *BlockNode

func (*Tree) RmBlock

func (t *Tree) RmBlock(hash chainhash.Hash, height int32)

func (*Tree) RootForHeight

func (t *Tree) RootForHeight(height int32) chainhash.Hash

type Value

type Value [ValueSize]byte

func (Value) Block

func (v Value) Block() (b Block)

Jump to

Keyboard shortcuts

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