Skip to content

Commit

Permalink
Merge pull request #223 from 2miners/master
Browse files Browse the repository at this point in the history
Bit boundary fix for the DAG generation routine
  • Loading branch information
iquidus authored Nov 6, 2020
2 parents e447981 + 03674af commit 98f92db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions consensus/ethash/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ func generateDataset(dest []uint32, epoch uint64, epochLength uint64, cache []ui
keccak512 := makeHasher(sha3.NewLegacyKeccak512())

// Calculate the data segment this thread should generate
batch := uint32((size + hashBytes*uint64(threads) - 1) / (hashBytes * uint64(threads)))
first := uint32(id) * batch
batch := (size + hashBytes*uint64(threads) - 1) / (hashBytes * uint64(threads))
first := uint64(id) * batch
limit := first + batch
if limit > uint32(size/hashBytes) {
limit = uint32(size / hashBytes)
if limit > size/hashBytes {
limit = size / hashBytes
}
// Calculate the dataset segment
percent := uint32(size / hashBytes / 100)
for index := first; index < limit; index++ {
item := generateDatasetItem(cache, index, keccak512)
item := generateDatasetItem(cache, uint32(index), keccak512)
if swapped {
swap(item)
}
Expand Down

0 comments on commit 98f92db

Please sign in to comment.