code: func (m *merkleTree) done() error {
  	logger.Debugf("Before done() = %s", m)
  	defer logger.Debugf("After done() = %s", m)
  	currentLevel := leafLevel
  	var h Hash
  	var err error
  	for currentLevel < m.maxLevel {
  		currentLevelHashes := m.tree[currentLevel]
  		switch len(currentLevelHashes) {
  		case 0:
  			currentLevel++
  			continue
  		case 1:
  			h = currentLevelHashes[0]
  		default:
  			if h, err = computeCombinedHash(currentLevelHashes); err != nil {
  				return err
  			}
  		}
  		delete(m.tree, currentLevel)
  		currentLevel++
  		m.tree[currentLevel] = append(m.tree[currentLevel], h)
  	}
  
  	finalHashes := m.tree[m.maxLevel]
  	if uint32(len(finalHashes)) > m.maxDegree {
  		delete(m.tree, m.maxLevel)
  		m.maxLevel++
  		combinedHash, err := computeCombinedHash(finalHashes)
  		if err != nil {
  			return err
  		}
  		m.tree[m.maxLevel] = []Hash{combinedHash}
  	}
  	return nil
  }
docs: // done completes the merkle tree.
  // There may have been some nodes that are at the levels lower than the maxLevel (maximum level seen by the tree so far).
  // Make the parent nodes out of such nodes till we complete the tree at the level of maxLevel (or maxLevel+1).