Fixed cppcheck errors

This commit is contained in:
SChernykh
2024-12-24 10:26:47 +01:00
parent 8cc49350f8
commit e95cc65c43
4 changed files with 8 additions and 11 deletions

View File

@@ -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<P2PServer*>(m_owner);
const std::vector<uint8_t>& consensus_id = owner->m_pool->side_chain().consensus_id();
const std::vector<uint8_t>& consensus_id = static_cast<const P2PServer*>(m_owner)->m_pool->side_chain().consensus_id();
const int consensus_id_size = static_cast<int>(consensus_id.size());
uint8_t challenge[CHALLENGE_SIZE];

View File

@@ -101,7 +101,7 @@ public:
[[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 @@ public:
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<hash>& missing_blocks, bool& result);
static void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& 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<hash>& missing_blocks, const bool result);
[[nodiscard]] bool is_good() const { return m_handshakeComplete && !m_handshakeInvalid && (m_listenPort >= 0); }

View File

@@ -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());

View File

@@ -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;