// check leaf nodes
// hasLeaf: whether a leaf node exists
// missingLeaf: whether there should be leaf nodes but not in this list (for example, the nodes
//              generated by the proof are not full nodes)
check leaf nodes
hasLeaf: whether a leaf node exists
missingLeaf: whether there should be leaf nodes but not in this list (for example, the nodes
generated by the proof are not full nodes)
// check leaf nodes // hasLeaf : whether a leaf node exists // missingLeaf : whether there should be leaf nodes but not in this list ( for example the nodes // generated by the proof are not full nodes )
func (n *TreeNode) checkLeafs() (hasLeaf bool, missingLeaf bool, lastLeaf int) {
	alreadyNil := false
	lastLeaf = -1
	for i := 0; i < childrenLength; i++ {
		if n.Leafs[i] != nil {
			hasLeaf = true
			lastLeaf = i
			if alreadyNil {
				missingLeaf = true
			}
		} else {
			alreadyNil = true
		}
	}
	return
}
func ( n * TreeNode ) checkLeafs ( ) ( hasLeaf bool , missingLeaf bool , lastLeaf int ) { alreadyNil := false lastLeaf = - 1 for i := 0 ; i < childrenLength ; i ++ { if n . Leafs [ i ] != nil { hasLeaf = true lastLeaf = i if alreadyNil { missingLeaf = true } } else { alreadyNil = true } } return }
check leaf nodes
hasLeaf: whether a leaf node exists
missingLeaf: whether there should be leaf nodes but not in this list (for example, the nodes
generated by the proof are not full nodes)
check leaf nodes hasLeaf : whether a leaf node exists missingLeaf : whether there should be leaf nodes but not in this list ( for example the nodes generated by the proof are not full nodes )