Documentation ¶
Index ¶
- type CPPMerkleTree
- func (m *CPPMerkleTree) AddLeaf(leaf []byte) uint64
- func (m *CPPMerkleTree) AddLeafHash(hash []byte) uint64
- func (m *CPPMerkleTree) CurrentRoot() ([]byte, error)
- func (m *CPPMerkleTree) DeletePeer()
- func (m *CPPMerkleTree) LeafCount() uint64
- func (m *CPPMerkleTree) LeafHash(leaf uint64) ([]byte, error)
- func (m *CPPMerkleTree) LevelCount() uint64
- func (m *CPPMerkleTree) PathToCurrentRoot(leaf uint64) ([][]byte, error)
- func (m *CPPMerkleTree) PathToRootAtSnapshot(leaf, snapshot uint64) ([][]byte, error)
- func (m *CPPMerkleTree) RootAtSnapshot(snapshot uint64) ([]byte, error)
- func (m *CPPMerkleTree) SnapshotConsistency(snapshot1, snapshot2 uint64) ([][]byte, error)
- type FullMerkleTreeInterface
- type MerkleTreeInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPPMerkleTree ¶
type CPPMerkleTree struct { FullMerkleTreeInterface // contains filtered or unexported fields }
CPPMerkleTree provides an interface to the C++ CT MerkleTree library. See the go/README file for details on how to build this.
func NewCPPMerkleTree ¶
func NewCPPMerkleTree() *CPPMerkleTree
NewCPPMerkleTree returns a new wrapped C++ MerkleTree, using the Sha256Hasher. It is the caller's responsibility to call DeletePeer() when finished with the tree to deallocate its resources.
func (*CPPMerkleTree) AddLeaf ¶
func (m *CPPMerkleTree) AddLeaf(leaf []byte) uint64
func (*CPPMerkleTree) AddLeafHash ¶
func (m *CPPMerkleTree) AddLeafHash(hash []byte) uint64
func (*CPPMerkleTree) CurrentRoot ¶
func (m *CPPMerkleTree) CurrentRoot() ([]byte, error)
func (*CPPMerkleTree) DeletePeer ¶
func (m *CPPMerkleTree) DeletePeer()
DeletePeer deallocates the memory used by the C++ MerkleTree peer.
func (*CPPMerkleTree) LeafCount ¶
func (m *CPPMerkleTree) LeafCount() uint64
func (*CPPMerkleTree) LevelCount ¶
func (m *CPPMerkleTree) LevelCount() uint64
func (*CPPMerkleTree) PathToCurrentRoot ¶
func (m *CPPMerkleTree) PathToCurrentRoot(leaf uint64) ([][]byte, error)
func (*CPPMerkleTree) PathToRootAtSnapshot ¶
func (m *CPPMerkleTree) PathToRootAtSnapshot(leaf, snapshot uint64) ([][]byte, error)
func (*CPPMerkleTree) RootAtSnapshot ¶
func (m *CPPMerkleTree) RootAtSnapshot(snapshot uint64) ([]byte, error)
func (*CPPMerkleTree) SnapshotConsistency ¶
func (m *CPPMerkleTree) SnapshotConsistency(snapshot1, snapshot2 uint64) ([][]byte, error)
type FullMerkleTreeInterface ¶
type FullMerkleTreeInterface interface { MerkleTreeInterface // RootAtSnapshot returns the root hash at the tree size |snapshot| // which must be <= than the current tree size. RootAtSnapshot(snapshot uint64) ([]byte, error) // PathToCurrentRoot returns the Merkle path (or inclusion proof) from the // leaf hash at index |leaf| to the current root. PathToCurrentRoot(leaf uint64) ([]byte, error) // SnapshotConsistency returns a consistency proof between the two tree // sizes specified in |snapshot1| and |snapshot2|. SnapshotConsistency(snapshot1, snapshot2 uint64) ([]byte, error) }
FullMerkleTreeInterface extends MerkleTreeInterface to the full range of operations that only a non-compact tree representation can implement.
type MerkleTreeInterface ¶
type MerkleTreeInterface interface { // LeafCount returns the number of leaves in the tree LeafCount() uint64 // LevelCount returns the number of levels in the tree LevelCount() uint64 // AddLeaf adds the hash of |leaf| to the tree and returns the newly added // leaf index AddLeaf(leaf []byte) uint64 // LeafHash returns the hash of the leaf at index |leaf| or a non-nil error. LeafHash(leaf uint64) ([]byte, error) // CurrentRoot returns the current root hash of the merkle tree. CurrentRoot() ([]byte, error) }
MerkleTreeInterface represents the common interface for basic MerkleTree functions.
Click to show internal directories.
Click to hide internal directories.