Fixed invalid shares.

This commit is contained in:
XMRig 2019-09-12 10:00:12 +07:00
parent 82595ee256
commit db79911c4b
2 changed files with 2 additions and 14 deletions

View file

@ -63,20 +63,12 @@ xmrig::RxCache::~RxCache()
bool xmrig::RxCache::init(const Buffer &seed) bool xmrig::RxCache::init(const Buffer &seed)
{ {
if (isReady(seed)) { if (m_seed == seed) {
return false; return false;
} }
m_seed = seed; m_seed = seed;
randomx_init_cache(m_cache, m_seed.data(), sizeof(m_seed)); randomx_init_cache(m_cache, m_seed.data(), m_seed.size());
m_initCount++;
return true; return true;
} }
bool xmrig::RxCache::isReady(const Buffer &seed) const
{
return !m_seed.isEmpty() && m_seed == seed;
}

View file

@ -55,19 +55,15 @@ public:
inline bool isJIT() const { return m_flags & 8; } inline bool isJIT() const { return m_flags & 8; }
inline const Buffer &seed() const { return m_seed; } inline const Buffer &seed() const { return m_seed; }
inline randomx_cache *get() const { return m_cache; } inline randomx_cache *get() const { return m_cache; }
inline uint64_t initCount() const { return m_initCount; }
bool init(const Buffer &seed); bool init(const Buffer &seed);
static inline constexpr size_t maxSize() { return RANDOMX_CACHE_MAX_SIZE; } static inline constexpr size_t maxSize() { return RANDOMX_CACHE_MAX_SIZE; }
private: private:
bool isReady(const Buffer &seed) const;
Buffer m_seed; Buffer m_seed;
int m_flags = 0; int m_flags = 0;
randomx_cache *m_cache = nullptr; randomx_cache *m_cache = nullptr;
uint64_t m_initCount = 0;
}; };