aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp23
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h14
2 files changed, 35 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;
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 4204e818f..7ee25ca85 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -1055,7 +1055,14 @@ namespace cryptonote
uint64_t speed;
uint32_t threads_count;
std::string address;
+ std::string pow_algorithm;
bool is_background_mining_enabled;
+ uint8_t bg_idle_threshold;
+ uint8_t bg_min_idle_seconds;
+ bool bg_ignore_battery;
+ uint8_t bg_target;
+ uint32_t block_target;
+ uint64_t block_reward;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
@@ -1063,7 +1070,14 @@ namespace cryptonote
KV_SERIALIZE(speed)
KV_SERIALIZE(threads_count)
KV_SERIALIZE(address)
+ KV_SERIALIZE(pow_algorithm)
KV_SERIALIZE(is_background_mining_enabled)
+ KV_SERIALIZE(bg_idle_threshold)
+ KV_SERIALIZE(bg_min_idle_seconds)
+ KV_SERIALIZE(bg_ignore_battery)
+ KV_SERIALIZE(bg_target)
+ KV_SERIALIZE(block_target)
+ KV_SERIALIZE(block_reward)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;