From 930b2e30ef05aac216d7df498d9d2cf72b51f124 Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 9 Jul 2019 22:33:01 +0300 Subject: [PATCH] minor log fixes and improvements --- src/currency_core/blockchain_storage.cpp | 2 +- src/gui/qt-daemon/application/daemon_backend.cpp | 13 ++++++++++--- src/gui/qt-daemon/application/daemon_backend.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index e3e3865c..cde8316c 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -1624,7 +1624,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto:: if (m_invalid_blocks.count(id) != 0) { - LOG_PRINT_RED_L0("Block recognized as blacklisted (parent " << b.prev_id << " is in blacklist) and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height); + LOG_PRINT_RED_L0("Block recognized as blacklisted and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height); } else if (m_invalid_blocks.count(b.prev_id) != 0) { diff --git a/src/gui/qt-daemon/application/daemon_backend.cpp b/src/gui/qt-daemon/application/daemon_backend.cpp index bc2ae40c..2c9a09e8 100644 --- a/src/gui/qt-daemon/application/daemon_backend.cpp +++ b/src/gui/qt-daemon/application/daemon_backend.cpp @@ -1534,10 +1534,17 @@ void daemon_backend::wallet_vs_options::worker_func() { pos_minin_interval.do_call([this](){ tools::wallet2::mining_context ctx = AUTO_VAL_INIT(ctx); - LOG_PRINT_L1(w->get()->get_log_prefix() + " Starting PoS mint iteration"); + LOG_PRINT_L1(get_log_prefix() + " Starting PoS mint iteration"); if (!w->get()->fill_mining_context(ctx) || ctx.rsp.status != CORE_RPC_STATUS_OK) + { + LOG_PRINT_L1(get_log_prefix() + " cannot obtain PoS mining context, skip iteration"); return true; - LOG_PRINT_L1(w->get()->get_log_prefix() + " POS_ENTRIES: " << ctx.sp.pos_entries.size()); + } + + uint64_t pos_entries_amount = 0; + for (auto& ent : ctx.sp.pos_entries) + pos_entries_amount += ent.amount; + tools::wallet2::scan_pos(ctx, break_mining_loop, [this](){ return *plast_daemon_network_state == currency::COMMAND_RPC_GET_INFO::daemon_network_state_online && *plast_daemon_height == last_wallet_synch_height; }, core_conf); @@ -1546,7 +1553,7 @@ void daemon_backend::wallet_vs_options::worker_func() { w->get()->build_minted_block(ctx.sp, ctx.rsp); } - LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(iterations: " << ctx.rsp.iterations_processed << "," << ctx.rsp.status << ")"); + LOG_PRINT_L1(get_log_prefix() << " PoS mining iteration finished, status: " << ctx.rsp.status << ", used " << ctx.sp.pos_entries.size() << " entries with total amount: " << currency::print_money_brief(pos_entries_amount) << ", processed: " << ctx.rsp.iterations_processed << " iter."); return true; }); } diff --git a/src/gui/qt-daemon/application/daemon_backend.h b/src/gui/qt-daemon/application/daemon_backend.h index 95d2ec3e..33a33272 100644 --- a/src/gui/qt-daemon/application/daemon_backend.h +++ b/src/gui/qt-daemon/application/daemon_backend.h @@ -71,6 +71,7 @@ public: std::thread miner_thread; void worker_func(); + std::string get_log_prefix() const { return std::string("[") + epee::string_tools::num_to_string_fast(wallet_id) + ":" + w->get()->get_log_prefix() + "]"; } ~wallet_vs_options(); };