More tests, code cleanup

This commit is contained in:
SChernykh
2024-06-26 11:25:21 +02:00
parent 75a894bbd1
commit b5558baa4c
6 changed files with 24 additions and 9 deletions

View File

@@ -23,6 +23,8 @@
#include "merge_mining_client_tari.h"
#endif
LOG_CATEGORY(MergeMiningClient)
namespace p2pool {
IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string& host, const std::string& wallet) noexcept
@@ -39,6 +41,7 @@ IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string&
}
}
catch (...) {
LOGERR(1, "Failed to create merge mining client for " << host);
}
return nullptr;
}

View File

@@ -384,7 +384,7 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* d
const char* status = result["status"].GetString();
// Empty string means no errors and the block was accepted
if (strlen(status) == 0) {
if (status[0] == '\0') {
status = "accepted";
}

View File

@@ -259,7 +259,7 @@ root_hash get_root_from_proof(hash h, const std::vector<hash>& proof, size_t ind
return root_hash(h);
}
bool verify_merkle_proof(hash h, const std::vector<hash>& proof, size_t index, size_t count, const root_hash& root)
bool verify_merkle_proof(const hash& h, const std::vector<hash>& proof, size_t index, size_t count, const root_hash& root)
{
return get_root_from_proof(h, proof, index, count) == root;
}

View File

@@ -26,7 +26,7 @@ bool get_merkle_proof(const std::vector<std::vector<hash>>& tree, const hash& h,
root_hash get_root_from_proof(hash h, const std::vector<hash>& proof, size_t index, size_t count);
bool verify_merkle_proof(hash h, const std::vector<hash>& proof, size_t index, size_t count, const root_hash& root);
bool verify_merkle_proof(const hash& h, const std::vector<hash>& proof, size_t index, size_t count, const root_hash& root);
bool verify_merkle_proof(hash h, const std::vector<hash>& proof, uint32_t path, const root_hash& root);
uint32_t get_aux_slot(const hash &id, uint32_t nonce, uint32_t n_aux_chains);

View File

@@ -564,7 +564,7 @@ void p2pool::update_aux_data(const hash& chain_id)
data.aux_nonce = m_auxNonce;
}
else if (find_aux_nonce(aux_id, data.aux_nonce)) {
m_auxId = aux_id;
m_auxId = std::move(aux_id);
m_auxNonce = data.aux_nonce;
}
else {