More fixes and refactoring

This commit is contained in:
SChernykh
2026-04-24 17:51:08 +02:00
parent e1acf7b786
commit fa53bdea55
8 changed files with 51 additions and 22 deletions
+12 -3
View File
@@ -94,15 +94,15 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
uv_mutex_init_checked(&m_workerLock);
uv_cond_init_checked(&m_workerCond);
uv_mutex_init_checked(&m_pushBlockLock);
uv_cond_init_checked(&m_pushBlockCond);
int err = uv_thread_create(&m_worker, run_wrapper, this);
if (err) {
LOGERR(1, "failed to start worker thread, error " << uv_err_name(err));
throw std::exception();
}
uv_mutex_init_checked(&m_pushBlockLock);
uv_cond_init_checked(&m_pushBlockCond);
std::ifstream f("tari_nodes.txt");
if (f.is_open()) {
@@ -851,6 +851,8 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
LOGINFO(4, node_address << " is at block height " << tip_info.metadata().best_block_height());
}
std::string prev_header_hash;
while (!m_pushBlockStop) {
Block block;
{
@@ -865,6 +867,13 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
}
const std::string& h = block.header().hash();
// Don't push the same block twice
if (h == prev_header_hash) {
continue;
}
prev_header_hash = h;
LOGINFO(4, "Pushing block " << log::hex_buf(h.data(), h.size()) << " to " << node_address);
grpc::ClientContext ctx;