code: func handleGetMiningInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
  	// Create a default getnetworkhashps command to use defaults and make
  	// use of the existing getnetworkhashps handler.
  	gnhpsCmd := btcjson.NewGetNetworkHashPSCmd(nil, nil)
  	networkHashesPerSecIface, err := handleGetNetworkHashPS(s, gnhpsCmd,
  		closeChan)
  	if err != nil {
  		return nil, err
  	}
  	networkHashesPerSec, ok := networkHashesPerSecIface.(int64)
  	if !ok {
  		return nil, &btcjson.RPCError{
  			Code:    btcjson.ErrRPCInternal.Code,
  			Message: "networkHashesPerSec is not an int64",
  		}
  	}
  
  	best := s.cfg.Chain.BestSnapshot()
  	result := btcjson.GetMiningInfoResult{
  		Blocks:             int64(best.Height),
  		CurrentBlockSize:   best.BlockSize,
  		CurrentBlockWeight: best.BlockWeight,
  		CurrentBlockTx:     best.NumTxns,
  		Difficulty:         getDifficultyRatio(best.Bits, s.cfg.ChainParams),
  		Generate:           s.cfg.CPUMiner.IsMining(),
  		GenProcLimit:       s.cfg.CPUMiner.NumWorkers(),
  		HashesPerSec:       int64(s.cfg.CPUMiner.HashesPerSecond()),
  		NetworkHashPS:      networkHashesPerSec,
  		PooledTx:           uint64(s.cfg.TxMemPool.Count()),
  		TestNet:            cfg.TestNet3,
  	}
  	return &result, nil
  }
docs: // handleGetMiningInfo implements the getmininginfo command. We only return the
  // fields that are not related to wallet functionality.