code: func newPersistentNodeDB(path string, version int, self NodeID) (*nodeDB, error) {
  	opts := &opt.Options{OpenFilesCacheCapacity: 5}
  	db, err := leveldb.OpenFile(path, opts)
  	if _, iscorrupted := err.(*errors.ErrCorrupted); iscorrupted {
  		db, err = leveldb.RecoverFile(path, nil)
  	}
  	if err != nil {
  		return nil, err
  	}
  	// The nodes contained in the cache correspond to a certain protocol version.
  	// Flush all nodes if the version doesn't match.
  	currentVer := make([]byte, binary.MaxVarintLen64)
  	currentVer = currentVer[:binary.PutVarint(currentVer, int64(version))]
  
  	blob, err := db.Get(nodeDBVersionKey, nil)
  	switch err {
  	case leveldb.ErrNotFound:
  		// Version not found (i.e. empty cache), insert it
  		if err := db.Put(nodeDBVersionKey, currentVer, nil); err != nil {
  			db.Close()
  			return nil, err
  		}
  
  	case nil:
  		// Version present, flush if different
  		if !bytes.Equal(blob, currentVer) {
  			db.Close()
  			if err = os.RemoveAll(path); err != nil {
  				return nil, err
  			}
  			return newPersistentNodeDB(path, version, self)
  		}
  	}
  	return &nodeDB{
  		lvl:  db,
  		self: self,
  		quit: make(chan struct{}),
  	}, nil
  }
docs: // newPersistentNodeDB creates/opens a leveldb backed persistent node database,
  // also flushing its contents in case of a version mismatch.