Skip to content

Commit

Permalink
consensus/ethash: only use *reflect.SliceHeader, not reflect.SliceHea…
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvanloon committed Jul 24, 2020
1 parent e997f92 commit adb1bce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consensus/ethash/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func generateCache(dest []uint32, epoch uint64, seed []byte) {
logFn("Generated ethash verification cache", "elapsed", common.PrettyDuration(elapsed))
}()
// Convert our destination slice to a byte buffer
header := *(*reflect.SliceHeader)(unsafe.Pointer(&dest))
header := (*reflect.SliceHeader)(unsafe.Pointer(&dest))
header.Len *= 4
header.Cap *= 4
cache := *(*[]byte)(unsafe.Pointer(&header))
cache := *(*[]byte)(unsafe.Pointer(header))

// Calculate the number of theoretical rows (we'll store in one buffer nonetheless)
size := uint64(len(cache))
Expand Down

0 comments on commit adb1bce

Please sign in to comment.