aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-09-25 17:52:15 -0400
committerRiccardo Spagni <ric@spagni.net>2019-09-25 17:52:16 -0400
commitb8643752c122a32096733fb8686d8f2eafcf6ff8 (patch)
tree6a735c25f25996dc2f31f02708d45a001f1315fc /src/rpc/core_rpc_server.cpp
parentMerge pull request #5930 (diff)
parentRandomX integration (diff)
downloadmonero-b8643752c122a32096733fb8686d8f2eafcf6ff8.tar.xz
Merge pull request #5549
81c2ad6d RandomX integration (Howard Chu)
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 3f53d59cf..66af4a364 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1060,6 +1060,7 @@ namespace cryptonote
case 1: res.pow_algorithm = "CNv1 (Cryptonight variant 1)"; break;
case 2: case 3: res.pow_algorithm = "CNv2 (Cryptonight variant 2)"; break;
case 4: case 5: res.pow_algorithm = "CNv4 (Cryptonight variant 4)"; break;
+ case 6: res.pow_algorithm = "RandomX"; break;
default: res.pow_algorithm = "I'm not sure actually"; break;
}
if (res.is_background_mining_enabled)
@@ -1440,6 +1441,18 @@ namespace cryptonote
LOG_ERROR("Failed to create block template");
return false;
}
+ if (b.major_version >= RX_BLOCK_VERSION)
+ {
+ uint64_t seed_height, next_height;
+ crypto::hash seed_hash;
+ crypto::rx_seedheights(res.height, &seed_height, &next_height);
+ seed_hash = m_core.get_block_id_by_height(seed_height);
+ res.seed_hash = string_tools::pod_to_hex(seed_hash);
+ if (next_height != seed_height) {
+ seed_hash = m_core.get_block_id_by_height(next_height);
+ res.next_seed_hash = string_tools::pod_to_hex(seed_hash);
+ }
+ }
store_difficulty(wdiff, res.difficulty, res.wide_difficulty, res.difficulty_top64);
blobdata block_blob = t_serializable_object_to_blob(b);
crypto::public_key tx_pub_key = cryptonote::get_tx_pub_key_from_extra(b.miner_tx);
@@ -1582,7 +1595,7 @@ namespace cryptonote
return false;
}
b.nonce = req.starting_nonce;
- miner::find_nonce_for_given_block(b, template_res.difficulty, template_res.height);
+ miner::find_nonce_for_given_block(&(m_core.get_blockchain_storage()), b, template_res.difficulty, template_res.height);
submit_req.front() = string_tools::buff_to_hex_nodelimer(block_to_blob(b));
r = on_submitblock(submit_req, submit_res, error_resp, ctx);
@@ -1627,7 +1640,7 @@ namespace cryptonote
response.reward = get_block_reward(blk);
response.block_size = response.block_weight = m_core.get_blockchain_storage().get_db().get_block_weight(height);
response.num_txes = blk.tx_hashes.size();
- response.pow_hash = fill_pow_hash ? string_tools::pod_to_hex(get_block_longhash(blk, height)) : "";
+ response.pow_hash = fill_pow_hash ? string_tools::pod_to_hex(get_block_longhash(&(m_core.get_blockchain_storage()), blk, height, 0)) : "";
response.long_term_weight = m_core.get_blockchain_storage().get_db().get_block_long_term_weight(height);
response.miner_tx_hash = string_tools::pod_to_hex(cryptonote::get_transaction_hash(blk.miner_tx));
return true;