From db79911c4bf413f610ef1cdf29b9f432040b0121 Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 12 Sep 2019 10:00:12 +0700 Subject: [PATCH] Fixed invalid shares. --- src/crypto/rx/RxCache.cpp | 12 ++---------- src/crypto/rx/RxCache.h | 4 ---- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/crypto/rx/RxCache.cpp b/src/crypto/rx/RxCache.cpp index 89f0cb58..e8fcb685 100644 --- a/src/crypto/rx/RxCache.cpp +++ b/src/crypto/rx/RxCache.cpp @@ -63,20 +63,12 @@ xmrig::RxCache::~RxCache() bool xmrig::RxCache::init(const Buffer &seed) { - if (isReady(seed)) { + if (m_seed == seed) { return false; } m_seed = seed; - randomx_init_cache(m_cache, m_seed.data(), sizeof(m_seed)); - - m_initCount++; + randomx_init_cache(m_cache, m_seed.data(), m_seed.size()); return true; } - - -bool xmrig::RxCache::isReady(const Buffer &seed) const -{ - return !m_seed.isEmpty() && m_seed == seed; -} diff --git a/src/crypto/rx/RxCache.h b/src/crypto/rx/RxCache.h index 2e61dbe4..f01e5087 100644 --- a/src/crypto/rx/RxCache.h +++ b/src/crypto/rx/RxCache.h @@ -55,19 +55,15 @@ public: inline bool isJIT() const { return m_flags & 8; } inline const Buffer &seed() const { return m_seed; } inline randomx_cache *get() const { return m_cache; } - inline uint64_t initCount() const { return m_initCount; } bool init(const Buffer &seed); static inline constexpr size_t maxSize() { return RANDOMX_CACHE_MAX_SIZE; } private: - bool isReady(const Buffer &seed) const; - Buffer m_seed; int m_flags = 0; randomx_cache *m_cache = nullptr; - uint64_t m_initCount = 0; };