code: func (s *State) Copy(db dbm.DB) (*State, error) {
  	stateCopy := NewState(db)
  	err := s.writeState.forest.IterateRWTree(nil, nil, true,
  		func(prefix []byte, tree *storage.RWTree) error {
  			treeCopy, err := stateCopy.writeState.forest.Writer(prefix)
  			if err != nil {
  				return err
  			}
  			return tree.IterateWriteTree(nil, nil, true, func(key []byte, value []byte) error {
  				treeCopy.Set(key, value)
  				return nil
  			})
  		})
  	if err != nil {
  		return nil, err
  	}
  	_, _, err = stateCopy.commit()
  	if err != nil {
  		return nil, err
  	}
  	return stateCopy, nil
  }
docs: // Creates a copy of the database to the supplied db