code: func newTree(segmentSize, depth int, hashfunc func() hash.Hash) *tree {
  	n := newNode(0, nil, hashfunc())
  	prevlevel := []*node{n}
  	// iterate over levels and creates 2^(depth-level) nodes
  	// the 0 level is on double segment sections so we start at depth - 2 since
  	count := 2
  	for level := depth - 2; level >= 0; level-- {
  		nodes := make([]*node, count)
  		for i := 0; i < count; i++ {
  			parent := prevlevel[i/2]
  			var hasher hash.Hash
  			if level == 0 {
  				hasher = hashfunc()
  			}
  			nodes[i] = newNode(i, parent, hasher)
  		}
  		prevlevel = nodes
  		count *= 2
  	}
  	// the datanode level is the nodes on the last level
  	return &tree{
  		leaves:  prevlevel,
  		result:  make(chan []byte),
  		section: make([]byte, 2*segmentSize),
  	}
  }
docs: // newTree initialises a tree by building up the nodes of a BMT
  // - segment size is stipulated to be the size of the hash