diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-08-15 18:50:16 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-08-15 19:38:39 +0800 |
commit | d8541a9f99c58d97ba4908c3a768e518f28d2441 (patch) | |
tree | 8da3166d1c102fbc56f17267461b9ce0dcbf72e4 /consensus/ethash/sealer.go | |
parent | e598ae5c010a9bc445fb3f106db9ae712e1a326e (diff) | |
download | dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar.gz dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar.bz2 dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar.lz dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar.xz dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.tar.zst dexon-d8541a9f99c58d97ba4908c3a768e518f28d2441.zip |
consensus/ethash: use DAGs for remote mining, generate async
Diffstat (limited to 'consensus/ethash/sealer.go')
-rw-r--r-- | consensus/ethash/sealer.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/consensus/ethash/sealer.go b/consensus/ethash/sealer.go index 03d848473..c3b2c86d1 100644 --- a/consensus/ethash/sealer.go +++ b/consensus/ethash/sealer.go @@ -114,7 +114,7 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s hash = header.HashNoNonce().Bytes() target = new(big.Int).Div(two256, header.Difficulty) number = header.Number.Uint64() - dataset = ethash.dataset(number) + dataset = ethash.dataset(number, false) ) // Start generating random nonces until we abort or find a good one var ( @@ -233,21 +233,22 @@ func (ethash *Ethash) remote(notify []string) { log.Info("Work submitted but none pending", "hash", hash) return false } - // Verify the correctness of submitted result. header := block.Header() header.Nonce = nonce header.MixDigest = mixDigest - if err := ethash.VerifySeal(nil, header); err != nil { - log.Warn("Invalid proof-of-work submitted", "hash", hash, "err", err) + + start := time.Now() + if err := ethash.verifySeal(nil, header, true); err != nil { + log.Warn("Invalid proof-of-work submitted", "hash", hash, "elapsed", time.Since(start), "err", err) return false } - // Make sure the result channel is created. if ethash.resultCh == nil { log.Warn("Ethash result channel is empty, submitted mining result is rejected") return false } + log.Trace("Verified correct proof-of-work", "hash", hash, "elapsed", time.Since(start)) // Solutions seems to be valid, return to the miner and notify acceptance. select { |