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