Skip to content

Commit c7a13c9

Browse files
committed
Merge pull request bnb-chain#969 from Gustav-Simonsson/ethash_improve_hashrate_update2
Make read of ethash hashrate atomic and update ethash godep
2 parents 2b06fe3 + b24f16f commit c7a13c9

5 files changed

Lines changed: 48 additions & 116 deletions

File tree

‎Godeps/Godeps.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go‎

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c‎

Lines changed: 28 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎miner/miner.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (self *Miner) Register(agent Agent) {
7070
}
7171

7272
func (self *Miner) HashRate() int64 {
73-
return self.worker.HashRate()
73+
return self.pow.GetHashrate()
7474
}
7575

7676
func (self *Miner) SetExtra(extra []byte) {

‎miner/worker.go‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ func (self *worker) stop() {
175175
func (self *worker) register(agent Agent) {
176176
self.mu.Lock()
177177
defer self.mu.Unlock()
178-
179178
self.agents = append(self.agents, agent)
180179
agent.SetReturnCh(self.recv)
181180
}
@@ -459,13 +458,9 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
459458
return nil
460459
}
461460

461+
// TODO: remove or use
462462
func (self *worker) HashRate() int64 {
463-
var tot int64
464-
for _, agent := range self.agents {
465-
tot += agent.GetHashRate()
466-
}
467-
468-
return tot
463+
return 0
469464
}
470465

471466
// gasprice calculates a reduced gas price based on the pct

0 commit comments

Comments
 (0)