Skip to content

Commit 55300d4

Browse files
committed
all: fix miner hashRate -> hashrate on API calls
1 parent 4a37ae5 commit 55300d4

6 files changed

Lines changed: 8 additions & 18 deletions

File tree

‎consensus/ethash/api.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) boo
8989
//
9090
// It accepts the miner hash rate and an identifier which must be unique
9191
// between nodes.
92-
func (api *API) SubmitHashRate(rate hexutil.Uint64, id common.Hash) bool {
92+
func (api *API) SubmitHashrate(rate hexutil.Uint64, id common.Hash) bool {
9393
if api.ethash.remote == nil {
9494
return false
9595
}

‎consensus/ethash/ethash_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestRemoteSealer(t *testing.T) {
135135
}
136136
}
137137

138-
func TestHashRate(t *testing.T) {
138+
func TestHashrate(t *testing.T) {
139139
var (
140140
hashrate = []hexutil.Uint64{100, 200, 300}
141141
expect uint64
@@ -150,7 +150,7 @@ func TestHashRate(t *testing.T) {
150150

151151
api := &API{ethash}
152152
for i := 0; i < len(hashrate); i += 1 {
153-
if res := api.SubmitHashRate(hashrate[i], ids[i]); !res {
153+
if res := api.SubmitHashrate(hashrate[i], ids[i]); !res {
154154
t.Error("remote miner submit hashrate failed")
155155
}
156156
expect += uint64(hashrate[i])
@@ -170,7 +170,7 @@ func TestClosedRemoteSealer(t *testing.T) {
170170
t.Error("expect to return an error to indicate ethash is stopped")
171171
}
172172

173-
if res := api.SubmitHashRate(hexutil.Uint64(100), common.HexToHash("a")); res {
173+
if res := api.SubmitHashrate(hexutil.Uint64(100), common.HexToHash("a")); res {
174174
t.Error("expect to return false when submit hashrate to a stopped ethash")
175175
}
176176
}

‎eth/api.go‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
6161
return api.Etherbase()
6262
}
6363

64-
// Hashrate returns the POW hashrate
65-
func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
66-
return hexutil.Uint64(api.e.Miner().HashRate())
67-
}
68-
6964
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
7065
func (api *PublicEthereumAPI) ChainId() (hexutil.Uint64, error) {
7166
// if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
@@ -149,11 +144,6 @@ func (api *PrivateMinerAPI) SetRecommitInterval(interval int) {
149144
api.e.Miner().SetRecommitInterval(time.Duration(interval) * time.Millisecond)
150145
}
151146

152-
// GetHashrate returns the current hashrate of the miner.
153-
func (api *PrivateMinerAPI) GetHashrate() uint64 {
154-
return api.e.miner.HashRate()
155-
}
156-
157147
// PrivateAdminAPI is the collection of Ethereum full node-related APIs
158148
// exposed over the private admin endpoint.
159149
type PrivateAdminAPI struct {

‎ethstats/ethstats.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ func (s *Service) reportStats(conn *connWrapper) error {
754754
fullBackend, ok := s.backend.(fullNodeBackend)
755755
if ok {
756756
mining = fullBackend.Miner().Mining()
757-
hashrate = int(fullBackend.Miner().HashRate())
757+
hashrate = int(fullBackend.Miner().Hashrate())
758758

759759
sync := fullBackend.Downloader().Progress()
760760
syncing = fullBackend.CurrentHeader().Number.Uint64() >= sync.HighestBlock

‎internal/web3ext/web3ext.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ web3._extend({
138138
params: 3,
139139
}),
140140
new web3._extend.Method({
141-
name: 'submitHashRate',
142-
call: 'ethash_submitHashRate',
141+
name: 'submitHashrate',
142+
call: 'ethash_submitHashrate',
143143
params: 2,
144144
}),
145145
]

‎miner/miner.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (miner *Miner) Mining() bool {
160160
return miner.worker.isRunning()
161161
}
162162

163-
func (miner *Miner) HashRate() uint64 {
163+
func (miner *Miner) Hashrate() uint64 {
164164
if pow, ok := miner.engine.(consensus.PoW); ok {
165165
return uint64(pow.Hashrate())
166166
}

0 commit comments

Comments
 (0)