consensus/ethash: fix a timestamp update race

parent 0255ed63
...@@ -467,8 +467,9 @@ func (ethash *Ethash) cache(block uint64) []uint32 { ...@@ -467,8 +467,9 @@ func (ethash *Ethash) cache(block uint64) []uint32 {
future = &cache{epoch: epoch + 1} future = &cache{epoch: epoch + 1}
ethash.fcache = future ethash.fcache = future
} }
} // New current cache, set its initial timestamp
current.used = time.Now() current.used = time.Now()
}
ethash.lock.Unlock() ethash.lock.Unlock()
// Wait for generation finish, bump the timestamp and finalize the cache // Wait for generation finish, bump the timestamp and finalize the cache
...@@ -529,8 +530,9 @@ func (ethash *Ethash) dataset(block uint64) []uint32 { ...@@ -529,8 +530,9 @@ func (ethash *Ethash) dataset(block uint64) []uint32 {
future = &dataset{epoch: epoch + 1} future = &dataset{epoch: epoch + 1}
ethash.fdataset = future ethash.fdataset = future
} }
} // New current dataset, set its initial timestamp
current.used = time.Now() current.used = time.Now()
}
ethash.lock.Unlock() ethash.lock.Unlock()
// Wait for generation finish, bump the timestamp and finalize the cache // Wait for generation finish, bump the timestamp and finalize the cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment