Merge mining: get a new block template immediately after submitting a block.
This commit is contained in:
@@ -322,6 +322,8 @@ void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*co
|
||||
if (size > 0) {
|
||||
LOGERR(3, "couldn't submit merge mining solution to " << m_host << ':' << m_port << ", error " << log::const_buf(data, size));
|
||||
}
|
||||
// Get new mining job
|
||||
on_timer();
|
||||
}, &m_loop);
|
||||
}
|
||||
|
||||
@@ -369,7 +371,7 @@ bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* data, size_t size)
|
||||
bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* data, size_t size) const
|
||||
{
|
||||
auto err = [this](const char* msg) {
|
||||
LOGWARN(3, "merge_mining_submit_solution to " << m_host << ':' << m_port << " failed: " << msg);
|
||||
@@ -418,10 +420,6 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* d
|
||||
}
|
||||
|
||||
LOGINFO(0, log::LightGreen() << "merge_mining_submit_solution to " << m_host << ':' << m_port << ": " << status);
|
||||
|
||||
// Get new mining job
|
||||
on_timer();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
void merge_mining_get_aux_block(uint64_t height, const hash& prev_id, const std::string& wallet);
|
||||
bool parse_merge_mining_get_aux_block(const char* data, size_t size, bool& changed);
|
||||
|
||||
bool parse_merge_mining_submit_solution(const char* data, size_t size);
|
||||
bool parse_merge_mining_submit_solution(const char* data, size_t size) const;
|
||||
|
||||
std::string m_host;
|
||||
uint32_t m_port;
|
||||
|
||||
@@ -472,6 +472,10 @@ void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase
|
||||
const std::string& h = response.block_hash();
|
||||
LOGINFO(0, log::LightGreen() << "Mined Tari block " << log::hex_buf(h.data(), h.size()) << " at height " << block.header().height());
|
||||
}
|
||||
|
||||
// We've just submitted a new block. Signal the polling thread to stop waiting and get a new block template.
|
||||
MutexLock lock(client->m_workerLock);
|
||||
uv_cond_signal(&client->m_workerCond);
|
||||
}
|
||||
} *work = new Work(this, std::move(block));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user