tidy up miner msgs

This commit is contained in:
wowario 2021-06-13 21:44:15 +03:00
parent 6f964b6cfb
commit 707bfe86ad
3 changed files with 32 additions and 15 deletions

View file

@ -526,7 +526,7 @@ namespace cryptonote
{ {
uint32_t th_local_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index); uint32_t th_local_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]"); MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]");
MGINFO("Miner thread was started ["<< th_local_index << "]"); MGINFO_GREEN("*Spins roulette wheel*... Mining started. Good luck!");
uint32_t nonce = m_starter_nonce + th_local_index; uint32_t nonce = m_starter_nonce + th_local_index;
uint64_t height = 0; uint64_t height = 0;
difficulty_type local_diff = 0; difficulty_type local_diff = 0;
@ -581,7 +581,34 @@ namespace cryptonote
{ {
//we lucky! //we lucky!
++m_config.current_extra_message_index; ++m_config.current_extra_message_index;
MGINFO_GREEN("Found block " << get_block_hash(b) << " at height " << height << " for difficulty: " << local_diff); MGINFO_YELLOW(ENDL <<
" ╦ ╦┬┌┐┌┐┌┌─┐┬─┐ ┬ ┬┬┌┐┌┐┌┌─┐┬─┐ ┌─┐┬ ┬┬┌─┐┬┌─┌─┐┌┐┌ ┌┬┐┬┌┐┌┐┌┌─┐┬─┐ ||\n"
" ║║║││││││├┤ ├┬┘ │││││││││├┤ ├┬┘ │ ├─┤││ ├┴┐├┤ │││ ││││││││├┤ ├┬┘ ||\n"
" ╚╩╝┴┘└┘└┘└─┘┴└─ └┴┘┴┘└┘└┘└─┘┴└─ └─┘┴ ┴┴└─┘┴ ┴└─┘┘└┘ ─┴┘┴┘└┘└┘└─┘┴└─ ()\n"
<< ENDL);
MGINFO_MAGENTA(ENDL <<
"\n\n"
" //@@@@@@@@@@@@@@@@@// \n"
" //%%%%%%%%%%%%%%%%%%%%%%%%%%%/% \n"
" @/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/& \n"
" /%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" &/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" ////////////%%%%%%%%%%%%%%%%%%%%%%#//////////// \n"
" /@@////////@@/%%%%%%%%%%%%%%%%%%%%%/@@////////@@/ \n"
" /@@////////@@/%%%%%%%%/@@#/%%%%%%%%/@@////////@@/ \n"
" /@@/////////@@/%%%%%%/@@@/@@@/%%%%%%/@@////////#@/ \n"
" /@&////////@@/%%%%/@@@/////@@@/%%%%/@@////////@@/ \n"
" /@@////////@@/%(/@@///////////@@/%%/@@////////@@/ \n"
" /@@////////@/@@@///////////////@@&@@////////@@/ \n"
" /@@///////@@@///////////////////@@@///////@@/ \n"
" /@@//////@///////////////////////@//////@@/ \n"
" #/@@/////////////////////////////////@@/ \n"
" /@@@///////////////////////////@@@/ \n"
" %/@@@@///////////////////@@@@/ \n"
" //@@@@@@@@@@@@@@@@@// \n"
<< ENDL);
MGINFO_GREEN("Awesome, you won a block reward!\n" << get_block_hash(b) << " at height " << height);
cryptonote::block_verification_context bvc; cryptonote::block_verification_context bvc;
if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain) if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain)
{ {

View file

@ -417,7 +417,7 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
} }
if (info.is_subaddress) if (info.is_subaddress)
{ {
tools::fail_msg_writer() << "subaddress for mining reward is not yet supported!" << std::endl; tools::fail_msg_writer() << "You can't use a subaddress to mine. You need to use your wallet's main address, which starts with \"Wo\"." << std::endl;
return true; return true;
} }
if(nettype != cryptonote::MAINNET) if(nettype != cryptonote::MAINNET)

View file

@ -590,13 +590,13 @@ bool t_rpc_command_executor::mining_status() {
} }
else else
{ {
tools::msg_writer() << "Mining at " << get_mining_speed(mres.speed) << " with " << mres.threads_count << " threads"; tools::msg_writer() << "\nMining at " << get_mining_speed(mres.speed) << " with " << mres.threads_count << " threads";
} }
tools::msg_writer() << "PoW algorithm: " << mres.pow_algorithm; tools::msg_writer() << "PoW algorithm: " << mres.pow_algorithm;
if (mres.active || mres.is_background_mining_enabled) if (mres.active || mres.is_background_mining_enabled)
{ {
tools::msg_writer() << "Mining address: " << mres.address; tools::msg_writer() << "Mining address:\n" << mres.address;
} }
if (mres.is_background_mining_enabled) if (mres.is_background_mining_enabled)
@ -608,16 +608,6 @@ bool t_rpc_command_executor::mining_status() {
tools::msg_writer() << " Ignore battery: " << (mres.bg_ignore_battery ? "yes" : "no"); tools::msg_writer() << " Ignore battery: " << (mres.bg_ignore_battery ? "yes" : "no");
} }
if (!mining_busy && mres.active && mres.speed > 0 && mres.block_target > 0 && mres.difficulty > 0)
{
double ratio = mres.speed * mres.block_target / (double)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) << " WOW daily, "
<< cryptonote::print_money(monthly) << " WOW monthly, " << cryptonote::print_money(yearly) << " yearly";
}
return true; return true;
} }