From 9094995996fe3900e70bf9fb430b4e332f1f338f Mon Sep 17 00:00:00 2001 From: hackyminer Date: Sat, 24 Nov 2018 21:58:44 +0900 Subject: [PATCH] stash fix (DO NOT MERGE) temporally fixed golang wrapper --- ethash.go | 6 +++--- ethashc.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ethash.go b/ethash.go index 837a16c1..4831b60e 100644 --- a/ethash.go +++ b/ethash.go @@ -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. @@ -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 } diff --git a/ethashc.go b/ethashc.go index 1d2ba161..63b51f41 100644 --- a/ethashc.go +++ b/ethashc.go @@ -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"