merkletree

package
v3.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*MerkleTree) Build

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

Build return the merkle tree

func (*MerkleTree) Descriptor

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

func (*MerkleTree) GetHash2Idx

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

func (*MerkleTree) GetHashList

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

func (*MerkleTree) GetLeafNum

func (m *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) Reset

func (m *MerkleTree) Reset()

func (*MerkleTree) RootHash

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

RootHash return root of the tree

func (*MerkleTree) String

func (m *MerkleTree) String() string

func (*MerkleTree) XXX_DiscardUnknown

func (m *MerkleTree) XXX_DiscardUnknown()

func (*MerkleTree) XXX_Marshal

func (m *MerkleTree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MerkleTree) XXX_Merge

func (m *MerkleTree) XXX_Merge(src proto.Message)

func (*MerkleTree) XXX_Size

func (m *MerkleTree) XXX_Size() int

func (*MerkleTree) XXX_Unmarshal

func (m *MerkleTree) XXX_Unmarshal(b []byte) error

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 */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

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

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

func (*TXRMerkleTree) Encode

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

Encode is marshal of the merkle tree

func (*TXRMerkleTree) GetMt

func (m *TXRMerkleTree) GetMt() *MerkleTree

func (*TXRMerkleTree) GetTx2Txr

func (m *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) Reset

func (m *TXRMerkleTree) Reset()

func (*TXRMerkleTree) RootHash

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

RootHash return root of merkle tree

func (*TXRMerkleTree) String

func (m *TXRMerkleTree) String() string

func (*TXRMerkleTree) XXX_DiscardUnknown

func (m *TXRMerkleTree) XXX_DiscardUnknown()

func (*TXRMerkleTree) XXX_Marshal

func (m *TXRMerkleTree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TXRMerkleTree) XXX_Merge

func (m *TXRMerkleTree) XXX_Merge(src proto.Message)

func (*TXRMerkleTree) XXX_Size

func (m *TXRMerkleTree) XXX_Size() int

func (*TXRMerkleTree) XXX_Unmarshal

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

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