Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
55300d4f
Unverified
Commit
55300d4f
authored
Mar 31, 2021
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: fix miner hashRate -> hashrate on API calls
parent
4a37ae51
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
18 deletions
+8
-18
api.go
consensus/ethash/api.go
+1
-1
ethash_test.go
consensus/ethash/ethash_test.go
+3
-3
api.go
eth/api.go
+0
-10
ethstats.go
ethstats/ethstats.go
+1
-1
web3ext.go
internal/web3ext/web3ext.go
+2
-2
miner.go
miner/miner.go
+1
-1
No files found.
consensus/ethash/api.go
View file @
55300d4f
...
...
@@ -89,7 +89,7 @@ func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) boo
//
// It accepts the miner hash rate and an identifier which must be unique
// between nodes.
func
(
api
*
API
)
SubmitHash
R
ate
(
rate
hexutil
.
Uint64
,
id
common
.
Hash
)
bool
{
func
(
api
*
API
)
SubmitHash
r
ate
(
rate
hexutil
.
Uint64
,
id
common
.
Hash
)
bool
{
if
api
.
ethash
.
remote
==
nil
{
return
false
}
...
...
consensus/ethash/ethash_test.go
View file @
55300d4f
...
...
@@ -135,7 +135,7 @@ func TestRemoteSealer(t *testing.T) {
}
}
func
TestHash
R
ate
(
t
*
testing
.
T
)
{
func
TestHash
r
ate
(
t
*
testing
.
T
)
{
var
(
hashrate
=
[]
hexutil
.
Uint64
{
100
,
200
,
300
}
expect
uint64
...
...
@@ -150,7 +150,7 @@ func TestHashRate(t *testing.T) {
api
:=
&
API
{
ethash
}
for
i
:=
0
;
i
<
len
(
hashrate
);
i
+=
1
{
if
res
:=
api
.
SubmitHash
R
ate
(
hashrate
[
i
],
ids
[
i
]);
!
res
{
if
res
:=
api
.
SubmitHash
r
ate
(
hashrate
[
i
],
ids
[
i
]);
!
res
{
t
.
Error
(
"remote miner submit hashrate failed"
)
}
expect
+=
uint64
(
hashrate
[
i
])
...
...
@@ -170,7 +170,7 @@ func TestClosedRemoteSealer(t *testing.T) {
t
.
Error
(
"expect to return an error to indicate ethash is stopped"
)
}
if
res
:=
api
.
SubmitHash
R
ate
(
hexutil
.
Uint64
(
100
),
common
.
HexToHash
(
"a"
));
res
{
if
res
:=
api
.
SubmitHash
r
ate
(
hexutil
.
Uint64
(
100
),
common
.
HexToHash
(
"a"
));
res
{
t
.
Error
(
"expect to return false when submit hashrate to a stopped ethash"
)
}
}
eth/api.go
View file @
55300d4f
...
...
@@ -61,11 +61,6 @@ func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
return
api
.
Etherbase
()
}
// Hashrate returns the POW hashrate
func
(
api
*
PublicEthereumAPI
)
Hashrate
()
hexutil
.
Uint64
{
return
hexutil
.
Uint64
(
api
.
e
.
Miner
()
.
HashRate
())
}
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func
(
api
*
PublicEthereumAPI
)
ChainId
()
(
hexutil
.
Uint64
,
error
)
{
// 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) {
api
.
e
.
Miner
()
.
SetRecommitInterval
(
time
.
Duration
(
interval
)
*
time
.
Millisecond
)
}
// GetHashrate returns the current hashrate of the miner.
func
(
api
*
PrivateMinerAPI
)
GetHashrate
()
uint64
{
return
api
.
e
.
miner
.
HashRate
()
}
// PrivateAdminAPI is the collection of Ethereum full node-related APIs
// exposed over the private admin endpoint.
type
PrivateAdminAPI
struct
{
...
...
ethstats/ethstats.go
View file @
55300d4f
...
...
@@ -754,7 +754,7 @@ func (s *Service) reportStats(conn *connWrapper) error {
fullBackend
,
ok
:=
s
.
backend
.
(
fullNodeBackend
)
if
ok
{
mining
=
fullBackend
.
Miner
()
.
Mining
()
hashrate
=
int
(
fullBackend
.
Miner
()
.
Hash
R
ate
())
hashrate
=
int
(
fullBackend
.
Miner
()
.
Hash
r
ate
())
sync
:=
fullBackend
.
Downloader
()
.
Progress
()
syncing
=
fullBackend
.
CurrentHeader
()
.
Number
.
Uint64
()
>=
sync
.
HighestBlock
...
...
internal/web3ext/web3ext.go
View file @
55300d4f
...
...
@@ -138,8 +138,8 @@ web3._extend({
params: 3,
}),
new web3._extend.Method({
name: 'submitHash
R
ate',
call: 'ethash_submitHash
R
ate',
name: 'submitHash
r
ate',
call: 'ethash_submitHash
r
ate',
params: 2,
}),
]
...
...
miner/miner.go
View file @
55300d4f
...
...
@@ -160,7 +160,7 @@ func (miner *Miner) Mining() bool {
return
miner
.
worker
.
isRunning
()
}
func
(
miner
*
Miner
)
Hash
R
ate
()
uint64
{
func
(
miner
*
Miner
)
Hash
r
ate
()
uint64
{
if
pow
,
ok
:=
miner
.
engine
.
(
consensus
.
PoW
);
ok
{
return
uint64
(
pow
.
Hashrate
())
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment