code: func (s *server) Stop() error {
  	// Make sure this only happens once.
  	if atomic.AddInt32(&s.shutdown, 1) != 1 {
  		srvrLog.Infof("Server is already in the process of shutting down")
  		return nil
  	}
  
  	srvrLog.Warnf("Server shutting down")
  
  	// Stop the CPU miner if needed
  	s.cpuMiner.Stop()
  
  	// Shutdown the RPC server if it's not disabled.
  	if !cfg.DisableRPC {
  		s.rpcServer.Stop()
  	}
  
  	// Save fee estimator state in the database.
  	s.db.Update(func(tx database.Tx) error {
  		metadata := tx.Metadata()
  		metadata.Put(mempool.EstimateFeeDatabaseKey, s.feeEstimator.Save())
  
  		return nil
  	})
  
  	// Signal the remaining goroutines to quit.
  	close(s.quit)
  	return nil
  }
docs: // Stop gracefully shuts down the server by stopping and disconnecting all
  // peers and the main listener.