aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-02 21:48:36 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-02 21:48:36 +0800
commitf8acc0af7e48ef3e6b1ed710fc429ece81db1dc8 (patch)
tree78ee697018e8ae15e0ccd08d056604f0142225ee /consensus/ethash
parent0255ed6335a6bb7fee210ba0ce3326b8669d0f11 (diff)
downloadgo-tangerine-f8acc0af7e48ef3e6b1ed710fc429ece81db1dc8.tar.gz
go-tangerine-f8acc0af7e48ef3e6b1ed710fc429ece81db1dc8.tar.zst
go-tangerine-f8acc0af7e48ef3e6b1ed710fc429ece81db1dc8.zip
consensus/ethash: fix a timestamp update race
Diffstat (limited to 'consensus/ethash')
-rw-r--r--consensus/ethash/ethash.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go
index b028f50e6..94a9ea332 100644
--- a/consensus/ethash/ethash.go
+++ b/consensus/ethash/ethash.go
@@ -467,8 +467,9 @@ func (ethash *Ethash) cache(block uint64) []uint32 {
future = &cache{epoch: epoch + 1}
ethash.fcache = future
}
+ // New current cache, set its initial timestamp
+ current.used = time.Now()
}
- current.used = time.Now()
ethash.lock.Unlock()
// Wait for generation finish, bump the timestamp and finalize the cache
@@ -529,8 +530,9 @@ func (ethash *Ethash) dataset(block uint64) []uint32 {
future = &dataset{epoch: epoch + 1}
ethash.fdataset = future
}
+ // New current dataset, set its initial timestamp
+ current.used = time.Now()
}
- current.used = time.Now()
ethash.lock.Unlock()
// Wait for generation finish, bump the timestamp and finalize the cache