Skip to content

Commit

Permalink
stash fix (DO NOT MERGE)
Browse files Browse the repository at this point in the history
temporally fixed golang wrapper
  • Loading branch information
hackmod committed Dec 10, 2018
1 parent 06c0dac commit 0e59331
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ethash.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func freeCache(cache *cache) {
cache.ptr = nil
}

func (cache *cache) compute(dagSize uint64, hash common.Hash, nonce uint64) (ok bool, mixDigest, result common.Hash) {
ret := C.ethash_light_compute_internal(cache.ptr, C.uint64_t(dagSize), hashToH256(hash), C.uint64_t(nonce))
func (cache *cache) compute(dagSize uint64, hash common.Hash, nonce uint64, block_number uint64) (ok bool, mixDigest, result common.Hash) {
ret := C.progpow_light_compute_internal(cache.ptr, C.uint64_t(dagSize), hashToH256(hash), C.uint64_t(nonce), C.uint64_t(block_number))
// Make sure cache is live until after the C call.
// This is important because a GC might happen and execute
// the finalizer before the call completes.
Expand Down Expand Up @@ -151,7 +151,7 @@ func (l *Light) Verify(block Block) bool {
dagSize = dagSizeForTesting
}
// Recompute the hash using the cache.
ok, mixDigest, result := cache.compute(uint64(dagSize), block.HashNoNonce(), block.Nonce())
ok, mixDigest, result := cache.compute(uint64(dagSize), block.HashNoNonce(), block.Nonce(), blockNum)
if !ok {
return false
}
Expand Down
1 change: 1 addition & 0 deletions ethashc.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ package ethash
#cgo LDFLAGS: -lm
#include "src/libethash/internal.c"
#include "src/libethash/progpow-internal.c"
#include "src/libethash/sha3.c"
#include "src/libethash/io.c"
Expand Down

0 comments on commit 0e59331

Please sign in to comment.