mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
consensus/ethash: fix vet
This commit is contained in:
parent
9ec4620b8c
commit
13fc988999
1 changed files with 6 additions and 6 deletions
|
|
@ -100,7 +100,6 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s
|
||||||
header = block.Header()
|
header = block.Header()
|
||||||
hash = header.HashNoNonce().Bytes()
|
hash = header.HashNoNonce().Bytes()
|
||||||
target = new(big.Int).Div(maxUint256, header.Difficulty)
|
target = new(big.Int).Div(maxUint256, header.Difficulty)
|
||||||
|
|
||||||
number = header.Number.Uint64()
|
number = header.Number.Uint64()
|
||||||
dataset = ethash.dataset(number)
|
dataset = ethash.dataset(number)
|
||||||
)
|
)
|
||||||
|
|
@ -111,13 +110,14 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s
|
||||||
)
|
)
|
||||||
logger := log.New("miner", id)
|
logger := log.New("miner", id)
|
||||||
logger.Trace("Started ethash search for new nonces", "seed", seed)
|
logger.Trace("Started ethash search for new nonces", "seed", seed)
|
||||||
|
search:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-abort:
|
case <-abort:
|
||||||
// Mining terminated, update stats and abort
|
// Mining terminated, update stats and abort
|
||||||
logger.Trace("Ethash nonce search aborted", "attempts", nonce-seed)
|
logger.Trace("Ethash nonce search aborted", "attempts", nonce-seed)
|
||||||
ethash.hashrate.Mark(attempts)
|
ethash.hashrate.Mark(attempts)
|
||||||
return
|
break search
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// We don't have to update hash rate on every nonce, so update after after 2^X nonces
|
// We don't have to update hash rate on every nonce, so update after after 2^X nonces
|
||||||
|
|
@ -141,7 +141,7 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s
|
||||||
case <-abort:
|
case <-abort:
|
||||||
logger.Trace("Ethash nonce found but discarded", "attempts", nonce-seed, "nonce", nonce)
|
logger.Trace("Ethash nonce found but discarded", "attempts", nonce-seed, "nonce", nonce)
|
||||||
}
|
}
|
||||||
return
|
break search
|
||||||
}
|
}
|
||||||
nonce++
|
nonce++
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue