浏览代码

Merge pull request #22765 from karalabe/revert-eth-hashrate

eth: restore eth_hashrate API endpoint
Péter Szilágyi 4 年之前
父节点
当前提交
871f50b911
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      eth/api.go

+ 5 - 0
eth/api.go

@@ -61,6 +61,11 @@ func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
 	return api.Etherbase()
 	return api.Etherbase()
 }
 }
 
 
+// Hashrate returns the POW hashrate
+func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
+	return hexutil.Uint64(api.e.Miner().Hashrate())
+}
+
 // PublicMinerAPI provides an API to control the miner.
 // PublicMinerAPI provides an API to control the miner.
 // It offers only methods that operate on data that pose no security risk when it is publicly accessible.
 // It offers only methods that operate on data that pose no security risk when it is publicly accessible.
 type PublicMinerAPI struct {
 type PublicMinerAPI struct {