Skip to content

Commit 0c34eae

Browse files
authored
Merge pull request ethereum#21803 from holiman/ethash
consensus/ethash: fix the percentage progress report
2 parents 7c30f4d + 81ff700 commit 0c34eae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

consensus/ethash/algorithm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func generateDataset(dest []uint32, epoch uint64, cache []uint32) {
295295
var pend sync.WaitGroup
296296
pend.Add(threads)
297297

298-
var progress uint32
298+
var progress uint64
299299
for i := 0; i < threads; i++ {
300300
go func(id int) {
301301
defer pend.Done()
@@ -311,16 +311,16 @@ func generateDataset(dest []uint32, epoch uint64, cache []uint32) {
311311
limit = uint32(size / hashBytes)
312312
}
313313
// Calculate the dataset segment
314-
percent := uint32(size / hashBytes / 100)
314+
percent := size / hashBytes / 100
315315
for index := first; index < limit; index++ {
316316
item := generateDatasetItem(cache, index, keccak512)
317317
if swapped {
318318
swap(item)
319319
}
320320
copy(dataset[index*hashBytes:], item)
321321

322-
if status := atomic.AddUint32(&progress, 1); status%percent == 0 {
323-
logger.Info("Generating DAG in progress", "percentage", uint64(status*100)/(size/hashBytes), "elapsed", common.PrettyDuration(time.Since(start)))
322+
if status := atomic.AddUint64(&progress, 1); status%percent == 0 {
323+
logger.Info("Generating DAG in progress", "percentage", (status*100)/(size/hashBytes), "elapsed", common.PrettyDuration(time.Since(start)))
324324
}
325325
}
326326
}(i)

0 commit comments

Comments
 (0)