func (mt *MerkleTree) CurrentRoot() TreeEntry {
	return mt.RootAtSnapshot(mt.LeafCount())
}
CurrentRoot set the current root of the tree.
Updates the root to reflect the current shape of the tree and returns the tree digest.

Returns the hash of an empty string if the tree has no leaves
(and hence, no root).
package inmemory
import (
	"errors"
	"fmt"
	"github.com/google/trillian/merkle/hashers"
)
type TreeEntry struct {
	hash []byte
}
func (t TreeEntry) Hash() []byte {
	var newSlice []byte
	return t.HashInto(newSlice)
}
func (t TreeEntry) HashInto(dest []byte) []byte {
	dest = dest[:0]  
	dest = append(dest, t.hash...)
	return dest
}
type TreeEntryDescriptor struct {
	Value  TreeEntry
	XCoord int64  
	YCoord int64  
}
type MerkleTree struct {
	tree            [][]TreeEntry
	leavesProcessed int64
	levelCount      int64
	hasher          hashers.LogHasher
}
func isPowerOfTwoPlusOne(leafCount int64) bool {
	if leafCount == 0 {
		return false
	}
	if leafCount == 1 {
		return true
	}
	return ((leafCount - 1) & (leafCount - 2)) == 0
}
func sibling(leaf int64) int64 {
	if isRightChild(leaf) {
		return leaf - 1
	}
	return leaf + 1
}
func NewMerkleTree(hasher hashers.LogHasher) *MerkleTree {
	return &MerkleTree{hasher: hasher}
}
func (mt *MerkleTree) LeafHash(leaf int64) []byte {
	if leaf == 0 || leaf > mt.LeafCount() {
		return nil
	}
	return mt.tree[0][leaf-1].hash
}
func (mt *MerkleTree) NodeCount(level int64) int64 {
	if mt.lazyLevelCount() <= level {
		panic(fmt.Errorf("lazyLevelCount <= level in nodeCount: %d", mt.lazyLevelCount()))
	}
	return int64(len(mt.tree[level]))
}
func (mt *MerkleTree) LevelCount() int64 {
	return mt.levelCount
}
func (mt *MerkleTree) lazyLevelCount() int64 {
	return int64(len(mt.tree))
}
func (mt *MerkleTree) LeafCount() int64 {
	if len(mt.tree) == 0 {
		return 0
	}
	return mt.NodeCount(0)
}
func (mt *MerkleTree) root() TreeEntry {
	lastLevel := len(mt.tree) - 1
	if len(mt.tree[lastLevel]) > 1 {
		panic(fmt.Errorf("found multiple nodes in root: %d", len(mt.tree[lastLevel])))
	}
	return mt.tree[lastLevel][0]
}
func (mt *MerkleTree) lastNode(level int64) TreeEntry {
	levelNodes := mt.NodeCount(level)
	if levelNodes < 1 {
		panic(fmt.Errorf("no nodes at level %d in lastNode", level))
	}
	return mt.tree[level][levelNodes-1]
}
func (mt *MerkleTree) addLevel() {
	mt.tree = append(mt.tree, []TreeEntry{})
}
func (mt *MerkleTree) pushBack(level int64, treeEntry TreeEntry) {
	if mt.lazyLevelCount() <= level {
		panic(fmt.Errorf("lazyLevelCount <= level in pushBack: %d", mt.lazyLevelCount()))
	}
	mt.tree[level] = append(mt.tree[level], treeEntry)
}
func (mt *MerkleTree) popBack(level int64) {
	if len(mt.tree[level]) < 1 {
		panic(errors.New("no nodes to pop in popBack"))
	}
	mt.tree[level] = mt.tree[level][:len(mt.tree[level])-1]
}
func (mt *MerkleTree) AddLeaf(leafData []byte) (int64, TreeEntry) {
	leafHash := mt.hasher.HashLeaf(leafData)
	leafCount, treeEntry := mt.addLeafHash(leafHash)
	return leafCount, treeEntry
}
func (mt *MerkleTree) addLeafHash(leafData []byte) (int64, TreeEntry) {
	treeEntry := TreeEntry{}
	treeEntry.hash = leafData
	if mt.lazyLevelCount() == 0 {
		mt.addLevel()
		mt.leavesProcessed = 1
	}
	mt.pushBack(0, treeEntry)
	leafCount := mt.LeafCount()
	if isPowerOfTwoPlusOne(leafCount) {
		mt.levelCount++
	}
	return leafCount, treeEntry
}