Tari: serialize pow_data WIP

This commit is contained in:
SChernykh
2024-05-09 20:35:41 +02:00
parent 258c93e661
commit fd953a0b26
10 changed files with 62 additions and 17 deletions
+13 -3
View File
@@ -635,8 +635,16 @@ void p2pool::submit_aux_block(const hash& chain_id, uint32_t template_id, uint32
size_t extra_nonce_offset = 0;
size_t merkle_root_offset = 0;
root_hash merge_mining_root;
const BlockTemplate* block_template = nullptr;
std::vector<uint8_t> blob = m_blockTemplate->get_block_template_blob(template_id, extra_nonce, nonce_offset, extra_nonce_offset, merkle_root_offset, merge_mining_root);
std::vector<uint8_t> blob = m_blockTemplate->get_block_template_blob(template_id, extra_nonce, nonce_offset, extra_nonce_offset, merkle_root_offset, merge_mining_root, &block_template);
uint8_t hashing_blob[128] = {};
uint64_t height = 0;
difficulty_type diff, aux_diff, sidechain_diff;
hash seed_hash;
m_blockTemplate->get_hashing_blob(template_id, extra_nonce, hashing_blob, height, diff, aux_diff, sidechain_diff, seed_hash, nonce_offset);
if (blob.empty()) {
LOGWARN(3, "submit_aux_block: block template blob not found");
@@ -671,7 +679,7 @@ void p2pool::submit_aux_block(const hash& chain_id, uint32_t template_id, uint32
}
}
c->submit_solution(blob, proof);
c->submit_solution(hashing_blob, nonce_offset, seed_hash, blob, proof);
}
else {
LOGWARN(3, "submit_aux_block: failed to get merkle proof for chain_id " << chain_id);
@@ -721,10 +729,12 @@ void p2pool::submit_block() const
size_t extra_nonce_offset = 0;
size_t merkle_root_offset = 0;
hash merge_mining_root;
const BlockTemplate* block_template = nullptr;
bool is_external = false;
if (submit_data.blob.empty()) {
submit_data.blob = m_blockTemplate->get_block_template_blob(submit_data.template_id, submit_data.extra_nonce, nonce_offset, extra_nonce_offset, merkle_root_offset, merge_mining_root);
submit_data.blob = m_blockTemplate->get_block_template_blob(submit_data.template_id, submit_data.extra_nonce, nonce_offset, extra_nonce_offset, merkle_root_offset, merge_mining_root, &block_template);
LOGINFO(0, log::LightGreen() << "submit_block: height = " << height
<< ", template id = " << submit_data.template_id