func (th *TreeHashStack) Top() *Node {
	if th.nodeStack.Empty() {
		return nil
	}
	return th.nodeStack.Peek().(*Node)
}
Top returns the node in the top of the stack
package mss
import (
	"fmt"
	"math"
	"github.com/LoCCS/mss/config"
	"github.com/LoCCS/mss/container/stack"
	"encoding/binary"
)
type Node struct {
	height uint32
	nu []byte
}
func (node *Node) String() string {
	return fmt.Sprintf("{height: %v}", node.height)
}
type TreeHashStack struct {
	leaf      uint32        
	leafUpper uint32        
	height    uint32        
	nodeStack *stack.Stack  
}
func (th *TreeHashStack) SetLeaf(leaf uint32) {
	th.leaf = leaf
}
func NewTreeHashStack(startingLeaf, h uint32) *TreeHashStack {
	treeHashStack := new(TreeHashStack)
	treeHashStack.Init(startingLeaf, h)
	return treeHashStack
}
func (th *TreeHashStack) Init(startingLeaf, h uint32) error {
	th.leaf, th.leafUpper, th.height = startingLeaf, startingLeaf+(1<<h), h
	th.nodeStack = stack.New()  
	return nil
}
func (th *TreeHashStack) IsCompleted() bool {
	return (th.leaf >= th.leafUpper) && (th.nodeStack.Peek().(*Node).height == th.height)
}
func (th *TreeHashStack) LowestTailHeight() uint32 {
	if th.nodeStack.Empty() {
		return th.height
	}
	if th.IsCompleted() {
		return math.MaxUint32
	}
	return th.Top().height
}