aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-02-22 20:17:45 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-09 20:51:53 +0000
commit59478c80dd01d00e16994a77e36a94cdbe3c9412 (patch)
tree7feed5e760c8affa62a9277a414942d13a05d2a9 /src/rpc/core_rpc_server.cpp
parentMerge pull request #4988 (diff)
downloadmonero-59478c80dd01d00e16994a77e36a94cdbe3c9412.tar.xz
daemon: new mining_status command
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index b524273bf..bb9768168 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -875,11 +875,30 @@ namespace cryptonote
res.active = lMiner.is_mining();
res.is_background_mining_enabled = lMiner.get_is_background_mining_enabled();
+ res.block_target = m_core.get_blockchain_storage().get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
if ( lMiner.is_mining() ) {
res.speed = lMiner.get_speed();
res.threads_count = lMiner.get_threads_count();
- const account_public_address& lMiningAdr = lMiner.get_mining_address();
- res.address = get_account_address_as_str(nettype(), false, lMiningAdr);
+ res.block_reward = lMiner.get_block_reward();
+ }
+ const account_public_address& lMiningAdr = lMiner.get_mining_address();
+ res.address = get_account_address_as_str(nettype(), false, lMiningAdr);
+ const uint8_t major_version = m_core.get_blockchain_storage().get_current_hard_fork_version();
+ const unsigned variant = major_version >= 7 ? major_version - 6 : 0;
+ switch (variant)
+ {
+ case 0: res.pow_algorithm = "Cryptonight"; break;
+ 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;
+ default: res.pow_algorithm = "I'm not sure actually"; break;
+ }
+ if (res.is_background_mining_enabled)
+ {
+ res.bg_idle_threshold = lMiner.get_idle_threshold();
+ res.bg_min_idle_seconds = lMiner.get_min_idle_seconds();
+ res.bg_ignore_battery = lMiner.get_ignore_battery();
+ res.bg_target = lMiner.get_mining_target();
}
res.status = CORE_RPC_STATUS_OK;