diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index 79d835ca..ab659ed8 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -1944,11 +1944,9 @@ void P2PServer::P2PClient::send_handshake_solution(const uint8_t (&challenge)[CH } } -bool P2PServer::P2PClient::check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]) +bool P2PServer::P2PClient::check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]) const { - P2PServer* owner = static_cast(m_owner); - - const std::vector& consensus_id = owner->m_pool->side_chain().consensus_id(); + const std::vector& consensus_id = static_cast(m_owner)->m_pool->side_chain().consensus_id(); const int consensus_id_size = static_cast(consensus_id.size()); uint8_t challenge[CHALLENGE_SIZE]; diff --git a/src/p2p_server.h b/src/p2p_server.h index ea5e91c1..b9173567 100644 --- a/src/p2p_server.h +++ b/src/p2p_server.h @@ -101,7 +101,7 @@ class P2PServer : public TCPServer [[nodiscard]] bool send_handshake_challenge(); void send_handshake_solution(const uint8_t (&challenge)[CHALLENGE_SIZE]); - [[nodiscard]] bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]); + [[nodiscard]] bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]) const; [[nodiscard]] bool on_handshake_challenge(const uint8_t* buf); [[nodiscard]] bool on_handshake_solution(const uint8_t* buf); @@ -115,7 +115,7 @@ class P2PServer : public TCPServer void on_block_notify(const uint8_t* buf); [[nodiscard]] bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0); - void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector& missing_blocks, bool& result); + static void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector& missing_blocks, bool& result); void post_handle_incoming_block(p2pool* pool, const PoolBlock& block, const uint32_t reset_counter, bool is_v6, const raw_ip& addr, std::vector& missing_blocks, const bool result); [[nodiscard]] bool is_good() const { return m_handshakeComplete && !m_handshakeInvalid && (m_listenPort >= 0); } diff --git a/src/p2pool.cpp b/src/p2pool.cpp index d46a756c..9399790d 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -582,12 +582,12 @@ void p2pool::update_aux_data(const hash& chain_id) aux_id.reserve(m_mergeMiningClients.size() + 1); - IMergeMiningClient::ChainParameters params; + IMergeMiningClient::ChainParameters chain_params; for (const IMergeMiningClient* c : m_mergeMiningClients) { - if (c->get_params(params)) { - data.aux_chains.emplace_back(params.aux_id, params.aux_hash, params.aux_diff); - aux_id.emplace_back(params.aux_id); + if (c->get_params(chain_params)) { + data.aux_chains.emplace_back(chain_params.aux_id, chain_params.aux_hash, chain_params.aux_diff); + aux_id.emplace_back(chain_params.aux_id); } } aux_id.emplace_back(m_sideChain->consensus_hash()); diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 5b16d75a..5ff34a9a 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -511,7 +511,6 @@ void SideChain::cleanup_incoming_blocks() MutexLock lock(m_incomingBlocksLock); // Forget seen blocks that were added more than 10 minutes ago - hash h; for (auto i = m_incomingBlocks.begin(); i != m_incomingBlocks.end();) { if (cur_time < i->second + 10 * 60) { ++i;