aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-11 13:01:30 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-11 13:01:30 +0200
commit3a4008f0fc56b921924f16cd70dbfa121b4ec46d (patch)
tree4963f9d99dc51a4cd1aae0cbf7ed0232213e1977 /src/daemon
parent036daa3af9d7bfb288bb49196604cb532cc925df (diff)
parenta2561653cbcba96e7e2dd352b9e0ea57cd220b2c (diff)
downloadmonzero-core-3a4008f0fc56b921924f16cd70dbfa121b4ec46d.tar.gz
monzero-core-3a4008f0fc56b921924f16cd70dbfa121b4ec46d.tar.xz
monzero-core-3a4008f0fc56b921924f16cd70dbfa121b4ec46d.zip
Merge pull request #5374
a2561653 wallet: new option to start background mining (moneromooo-monero)
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/rpc_command_executor.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index c9ec5109e..106d1c00a 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -551,11 +551,12 @@ bool t_rpc_command_executor::mining_status() {
tools::msg_writer() << " Ignore battery: " << (mres.bg_ignore_battery ? "yes" : "no");
}
- if (!mining_busy && mres.active)
+ if (!mining_busy && mres.active && mres.speed > 0 && mres.block_target > 0 && mres.difficulty > 0)
{
- uint64_t daily = 86400ull / mres.block_target * mres.block_reward;
- uint64_t monthly = 86400ull / mres.block_target * 30.5 * mres.block_reward;
- uint64_t yearly = 86400ull / mres.block_target * 356 * mres.block_reward;
+ double ratio = mres.speed * mres.block_target / mres.difficulty;
+ uint64_t daily = 86400ull / mres.block_target * mres.block_reward * ratio;
+ uint64_t monthly = 86400ull / mres.block_target * 30.5 * mres.block_reward * ratio;
+ uint64_t yearly = 86400ull / mres.block_target * 356 * mres.block_reward * ratio;
tools::msg_writer() << "Expected: " << cryptonote::print_money(daily) << " monero daily, "
<< cryptonote::print_money(monthly) << " monero monthly, " << cryptonote::print_money(yearly) << " yearly";
}