mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 19:40:36 +00:00
consensus/ethash: use 64bit indexes for the DAG generation (#21793)
* Bit boundary fix for the DAG generation routine * Fix unnecessary conversion warnings Co-authored-by: Sergey Pavlov <spavlov@gmail.com>
This commit is contained in:
parent
3f3f8d02cf
commit
2a79ac1622
@ -304,16 +304,16 @@ func generateDataset(dest []uint32, epoch uint64, cache []uint32) {
|
|||||||
keccak512 := makeHasher(sha3.NewLegacyKeccak512())
|
keccak512 := makeHasher(sha3.NewLegacyKeccak512())
|
||||||
|
|
||||||
// Calculate the data segment this thread should generate
|
// Calculate the data segment this thread should generate
|
||||||
batch := uint32((size + hashBytes*uint64(threads) - 1) / (hashBytes * uint64(threads)))
|
batch := (size + hashBytes*uint64(threads) - 1) / (hashBytes * uint64(threads))
|
||||||
first := uint32(id) * batch
|
first := uint64(id) * batch
|
||||||
limit := first + batch
|
limit := first + batch
|
||||||
if limit > uint32(size/hashBytes) {
|
if limit > size/hashBytes {
|
||||||
limit = uint32(size / hashBytes)
|
limit = size / hashBytes
|
||||||
}
|
}
|
||||||
// Calculate the dataset segment
|
// Calculate the dataset segment
|
||||||
percent := uint32(size / hashBytes / 100)
|
percent := uint32(size / hashBytes / 100)
|
||||||
for index := first; index < limit; index++ {
|
for index := first; index < limit; index++ {
|
||||||
item := generateDatasetItem(cache, index, keccak512)
|
item := generateDatasetItem(cache, uint32(index), keccak512)
|
||||||
if swapped {
|
if swapped {
|
||||||
swap(item)
|
swap(item)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user