aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/rx-slow-hash.c
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2019-10-07 09:50:00 +0100
committerHoward Chu <hyc@symas.com>2019-10-07 09:50:00 +0100
commitf54301dd752ac1c6ff43d1e9e69f07b16313bf41 (patch)
tree4f6951c399569ee11e8ff0df7554230b0f3fc94f /src/crypto/rx-slow-hash.c
parentUpdate to RandomX v1.1.3, simplify (diff)
downloadmonero-f54301dd752ac1c6ff43d1e9e69f07b16313bf41.tar.xz
Fix for miners on reorg
Make sure dataset gets re-init'd if a reorg changes the epoch
Diffstat (limited to 'src/crypto/rx-slow-hash.c')
-rw-r--r--src/crypto/rx-slow-hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c
index 11aa5584d..59bd89d13 100644
--- a/src/crypto/rx-slow-hash.c
+++ b/src/crypto/rx-slow-hash.c
@@ -161,8 +161,11 @@ void rx_reorg(const uint64_t split_height) {
int i;
CTHR_MUTEX_LOCK(rx_mutex);
for (i=0; i<2; i++) {
- if (split_height < rx_s[i].rs_height)
+ if (split_height <= rx_s[i].rs_height) {
+ if (rx_s[i].rs_height == rx_dataset_height)
+ rx_dataset_height = 1;
rx_s[i].rs_height = 1; /* set to an invalid seed height */
+ }
}
CTHR_MUTEX_UNLOCK(rx_mutex);
}