code: func (db *Database) commit(hash common.Hash, batch ethdb.Batch, uncacher *cleaner) error {
  	// If the node does not exist, it's a previously committed node
  	node, ok := db.dirties[hash]
  	if !ok {
  		return nil
  	}
  	for _, child := range node.childs() {
  		if err := db.commit(child, batch, uncacher); err != nil {
  			return err
  		}
  	}
  	if err := batch.Put(hash[:], node.rlp()); err != nil {
  		return err
  	}
  	// If we've reached an optimal batch size, commit and start over
  	if batch.ValueSize() >= ethdb.IdealBatchSize {
  		if err := batch.Write(); err != nil {
  			return err
  		}
  		db.lock.Lock()
  		batch.Replay(uncacher)
  		batch.Reset()
  		db.lock.Unlock()
  	}
  	return nil
  }
docs: // commit is the private locked version of Commit.