aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-17 17:55:32 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-17 17:55:32 +0200
commit429930534df43b8bef46a4a39dbfbc3d3b5939b0 (patch)
tree0280220db27a66d12d16e3b42a003cebab00177a /src/rpc/core_rpc_server.cpp
parentMerge pull request #5182 (diff)
parentdaemon: new mining_status command (diff)
downloadmonero-429930534df43b8bef46a4a39dbfbc3d3b5939b0.tar.xz
Merge pull request #5185
59478c80 daemon: new mining_status command (moneromooo-monero)
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 ecb8fc2c8..6357f84b1 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -915,11 +915,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;