merkletree

package
v3.11.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_core_merkletree_merkle_tree_proto protoreflect.FileDescriptor

Functions

func Init

func Init(levelDBPath string) error

Init is init the database

func Uint64ToBytes

func Uint64ToBytes(n uint64) []byte

Uint64ToBytes ...

Types

type MerkleTree

type MerkleTree struct {
	HashList [][]byte         `protobuf:"bytes,1,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"`
	Hash2Idx map[string]int32 `` /* 174-byte string literal not displayed */
	LeafNum  int32            `protobuf:"varint,3,opt,name=leaf_num,json=leafNum,proto3" json:"leaf_num,omitempty"`
	// contains filtered or unexported fields
}

func (*MerkleTree) Build

func (m *MerkleTree) Build(data [][]byte)

Build return the merkle tree

func (*MerkleTree) Descriptor deprecated

func (*MerkleTree) Descriptor() ([]byte, []int)

Deprecated: Use MerkleTree.ProtoReflect.Descriptor instead.

func (*MerkleTree) GetHash2Idx

func (x *MerkleTree) GetHash2Idx() map[string]int32

func (*MerkleTree) GetHashList

func (x *MerkleTree) GetHashList() [][]byte

func (*MerkleTree) GetLeafNum

func (x *MerkleTree) GetLeafNum() int32

func (*MerkleTree) MerklePath

func (m *MerkleTree) MerklePath(hash []byte) ([][]byte, error)

MerklePath is path of the merkle tree

func (*MerkleTree) ProtoMessage

func (*MerkleTree) ProtoMessage()

func (*MerkleTree) ProtoReflect

func (x *MerkleTree) ProtoReflect() protoreflect.Message

func (*MerkleTree) Reset

func (x *MerkleTree) Reset()

func (*MerkleTree) RootHash

func (m *MerkleTree) RootHash() []byte

RootHash return root of the tree

func (*MerkleTree) String

func (x *MerkleTree) String() string

type TXRMerkleTree

type TXRMerkleTree struct {
	Mt     *MerkleTree       `protobuf:"bytes,1,opt,name=mt,proto3" json:"mt,omitempty"`
	Tx2Txr map[string][]byte `` /* 167-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*TXRMerkleTree) Build

func (m *TXRMerkleTree) Build(txrs []*tx.TxReceipt)

Build return the merkle tree

func (*TXRMerkleTree) Decode

func (m *TXRMerkleTree) Decode(b []byte) error

Decode is unmarshal of the merkle tree

func (*TXRMerkleTree) Descriptor deprecated

func (*TXRMerkleTree) Descriptor() ([]byte, []int)

Deprecated: Use TXRMerkleTree.ProtoReflect.Descriptor instead.

func (*TXRMerkleTree) Encode

func (m *TXRMerkleTree) Encode() ([]byte, error)

Encode is marshal of the merkle tree

func (*TXRMerkleTree) GetMt

func (x *TXRMerkleTree) GetMt() *MerkleTree

func (*TXRMerkleTree) GetTx2Txr

func (x *TXRMerkleTree) GetTx2Txr() map[string][]byte

func (*TXRMerkleTree) MerklePath

func (m *TXRMerkleTree) MerklePath(hash []byte) ([][]byte, error)

MerklePath return path of the merkle tree

func (*TXRMerkleTree) MerkleProve

func (m *TXRMerkleTree) MerkleProve(hash []byte, rootHash []byte, mp [][]byte) (bool, error)

MerkleProve return prove of the merkle tree

func (*TXRMerkleTree) ProtoMessage

func (*TXRMerkleTree) ProtoMessage()

func (*TXRMerkleTree) ProtoReflect

func (x *TXRMerkleTree) ProtoReflect() protoreflect.Message

func (*TXRMerkleTree) Reset

func (x *TXRMerkleTree) Reset()

func (*TXRMerkleTree) RootHash

func (m *TXRMerkleTree) RootHash() []byte

RootHash return root of merkle tree

func (*TXRMerkleTree) String

func (x *TXRMerkleTree) String() string

type TXRMerkleTreeDB

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

TXRMerkleTreeDB is the implementation of TXRMerkleTreeDB

var TXRMTDB TXRMerkleTreeDB

TXRMTDB ...

func (*TXRMerkleTreeDB) Get

func (mdb *TXRMerkleTreeDB) Get(blockNum uint64) (*TXRMerkleTree, error)

Get return the merkle tree

func (*TXRMerkleTreeDB) Put

func (mdb *TXRMerkleTreeDB) Put(m *TXRMerkleTree, blockNum uint64) error

Put ...

Jump to

Keyboard shortcuts

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