From 710e55422a884dc7e943294ae5163940fa4f058a Mon Sep 17 00:00:00 2001 From: SChernykh Date: Wed, 11 May 2022 16:10:10 +0200 Subject: [PATCH] Ignore duplicate get_miner_data --- src/p2pool.cpp | 9 +++++++++ src/p2pool.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 79511fe..be8eebf 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -35,6 +35,7 @@ #include "crypto.h" #include "p2pool_api.h" #include "pool_block.h" +#include "keccak.h" #include #include @@ -927,6 +928,14 @@ void p2pool::get_miner_data() void p2pool::parse_get_miner_data_rpc(const char* data, size_t size) { + hash h; + keccak(reinterpret_cast(data), static_cast(size), h.h, HASH_SIZE); + if (h == m_getMinerDataHash) { + LOGWARN(4, "Received a duplicate get_miner_data RPC response, ignoring it"); + return; + } + m_getMinerDataHash = h; + rapidjson::Document doc; doc.Parse(data, size); diff --git a/src/p2pool.h b/src/p2pool.h index 781f4b0..6e0d69a 100644 --- a/src/p2pool.h +++ b/src/p2pool.h @@ -202,6 +202,8 @@ private: uv_async_t m_restartZMQAsync; ZMQReader* m_ZMQReader = nullptr; + + hash m_getMinerDataHash; }; } // namespace p2pool