Unwrap fmt::format with a style argument

oxen::logging handles a style argument now (it is also safer e.g. if the
final formatted string itself intentionally contains {}).
This commit is contained in:
Jason Rhinelander 2022-09-22 21:35:35 -03:00
parent c9934b9f5f
commit 085e9ba963
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
14 changed files with 127 additions and 121 deletions

View File

@ -1429,7 +1429,7 @@ void BlockchainLMDB::open(const fs::path& filename, cryptonote::network_type net
#ifdef __OpenBSD__
if ((mdb_flags & MDB_WRITEMAP) == 0) {
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Running on OpenBSD: forcing WRITEMAP"));
log::info(logcat, fg(fmt::terminal_color::red), "Running on OpenBSD: forcing WRITEMAP");
mdb_flags |= MDB_WRITEMAP;
}
#endif
@ -4848,7 +4848,7 @@ void BlockchainLMDB::migrate_0_1()
MDB_val k, v;
char *ptr;
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 0 to 1 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 0 to 1 - this may take a while:");
log::info(logcat, "updating blocks, hf_versions, outputs, txs, and spent_keys tables...");
do {
@ -5382,7 +5382,7 @@ void BlockchainLMDB::migrate_1_2()
MDB_val k, v;
char *ptr;
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 1 to 2 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 1 to 2 - this may take a while:");
log::info(logcat, "updating txs_pruned and txs_prunable tables...");
do {
@ -5517,7 +5517,7 @@ void BlockchainLMDB::migrate_2_3()
MDB_val k, v;
char *ptr;
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 2 to 3 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 2 to 3 - this may take a while:");
do {
log::info(logcat, "migrating block info:");
@ -5633,7 +5633,7 @@ void BlockchainLMDB::migrate_2_3()
void BlockchainLMDB::migrate_3_4()
{
log::trace(logcat, "BlockchainLMDB::{}", __func__);
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 3 to 4 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 3 to 4 - this may take a while:");
// Migrate output blacklist
{
@ -5862,7 +5862,7 @@ void BlockchainLMDB::migrate_3_4()
void BlockchainLMDB::migrate_4_5(cryptonote::network_type nettype)
{
log::trace(logcat, "BlockchainLMDB::{}", __func__);
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 4 to 5 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 4 to 5 - this may take a while:");
mdb_txn_safe txn(false);
{
@ -5935,7 +5935,7 @@ void BlockchainLMDB::migrate_4_5(cryptonote::network_type nettype)
void BlockchainLMDB::migrate_5_6()
{
log::trace(logcat, "BlockchainLMDB::{}", __func__);
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 5 to 6 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 5 to 6 - this may take a while:");
mdb_txn_safe txn(false);
{
@ -6044,7 +6044,7 @@ void BlockchainLMDB::migrate_5_6()
void BlockchainLMDB::migrate_6_7()
{
log::trace(logcat, "BlockchainLMDB::{}", __func__);
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 6 to 7 - this may take a while:"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Migrating blockchain from DB version 6 to 7 - this may take a while:");
std::vector<checkpoint_t> checkpoints;
checkpoints.reserve(1024);

View File

@ -678,13 +678,13 @@ int main(int argc, char* argv[])
if (!opt_verify)
{
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "\n\
log::warning(logcat, fg(fmt::terminal_color::red), "\n\
Import is set to proceed WITHOUT VERIFICATION.\n\
This is a DANGEROUS operation: if the file was tampered with in transit, or obtained from a malicious source,\n\
you could end up with a compromised database. It is recommended to NOT use {}.\n\
*****************************************************************************************\n\
You have 90 seconds to press ^C or terminate this program before unverified import starts\n\
*****************************************************************************************", arg_noverify.name));
*****************************************************************************************", arg_noverify.name);
sleep(90);
}

View File

@ -12,7 +12,7 @@ scoped_message_writer::~scoped_message_writer()
if (fmt::terminal_color::white == m_color)
logcat->log(m_log_level, m_oss.str());
else
logcat->log(m_log_level, fmt::format(fg(m_color),m_oss.str()));
logcat->log(m_log_level, "{}", fmt::format(fg(m_color), m_oss.str()));
std::cout << std::endl;
}
}

View File

@ -48,7 +48,7 @@ namespace tools {
}
else
{
log::info(globallogcat, fmt::format(fg(fmt::terminal_color::red), "Got control signal {}. Exiting without saving...", type);
log::info(globallogcat, fg(fmt::terminal_color::red), "Got control signal {}. Exiting without saving...", type);
return FALSE;
}
return TRUE;

View File

@ -92,7 +92,7 @@ namespace tools
#ifdef __GLIBC__
const char *ver = ::gnu_get_libc_version();
if (!strcmp(ver, "2.25"))
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "Running with glibc {}, hangs may occur - change glibc version if possible", ver));
log::warning(logcat, fg(fmt::terminal_color::red), "Running with glibc {}, hangs may occur - change glibc version if possible", ver);
#endif
return true;

View File

@ -345,7 +345,7 @@ namespace cryptonote
if(check_hash(h, local_diff))
{
//we lucky!
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Found block {} at height {} for difficulty: {}", get_block_hash(b), height, local_diff));
log::info(logcat, fg(fmt::terminal_color::green), "Found block {} at height {} for difficulty: {}", get_block_hash(b), height, local_diff);
cryptonote::block_verification_context bvc;
m_phandler->handle_block_found(b, bvc);
}

View File

@ -1181,7 +1181,7 @@ bool Blockchain::switch_to_alternative_blockchain(const std::list<block_extended
hook(hook_data);
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "REORGANIZE SUCCESS! on height: {}, new blockchain size: {}", split_height, m_db->height()));
log::info(logcat, fg(fmt::terminal_color::green), "REORGANIZE SUCCESS! on height: {}, new blockchain size: {}", split_height, m_db->height());
return true;
}
//------------------------------------------------------------------
@ -1379,7 +1379,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
try {
hook(hook_data);
} catch (const std::exception& e) {
log::info(globallogcat, fmt::format(fg(fmt::terminal_color::red), "Miner tx failed validation: {}", e.what()));
log::info(globallogcat, fg(fmt::terminal_color::red), "Miner tx failed validation: {}", e.what());
return false;
}
}
@ -2161,12 +2161,11 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
}
else
{
std::stringstream stream;
stream << "----- " << block_type << " BLOCK ADDED AS ALTERNATIVE ON HEIGHT " << blk_height << "\n" << "id: " << id;
if (!pulse_block) stream << " PoW: " << blk_pow.proof_of_work;
stream << " difficulty: " << current_diff;
std::string msg = fmt::format("----- {} BLOCK ADDED AS ALTERNATIVE ON HEIGHT {}\nid: {}", block_type, blk_height, id);
if (!pulse_block) fmt::format_to(std::back_inserter(msg), " PoW: {}", blk_pow.proof_of_work);
fmt::format_to(std::back_inserter(msg), " difficulty {}", current_diff);
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "{}", stream.str()));
log::info(logcat, fg(fmt::terminal_color::blue), "{}", msg);
return true;
}
}
@ -2182,12 +2181,12 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
bool keep_alt_chain = false;
if (alt_chain_has_more_checkpoints)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {}, checkpoint is found in alternative chain on height {}", alt_chain.front().height, m_db->height() - 1, blk_height));
log::info(logcat, fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {}, checkpoint is found in alternative chain on height {}", alt_chain.front().height, m_db->height() - 1, blk_height);
}
else
{
keep_alt_chain = true;
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {} with cum_difficulty {}\n alternative blockchain size: {} with cum_difficulty {}", alt_chain.front().height, m_db->height() - 1, m_db->get_block_cumulative_difficulty(m_db->height() - 1), alt_chain.size(), alt_data.cumulative_difficulty));
log::info(logcat, fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {} with cum_difficulty {}\n alternative blockchain size: {} with cum_difficulty {}", alt_chain.front().height, m_db->height() - 1, m_db->get_block_cumulative_difficulty(m_db->height() - 1), alt_chain.size(), alt_data.cumulative_difficulty);
}
bool r = switch_to_alternative_blockchain(alt_chain, keep_alt_chain);
@ -2199,7 +2198,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
}
else
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "----- {} BLOCK ADDED AS ALTERNATIVE ON HEIGHT {}\nid:\t{}\nPoW:\t{}\ndifficulty:\t{}", block_type, blk_height, id, blk_pow.proof_of_work, current_diff));
log::info(logcat, fg(fmt::terminal_color::blue), "----- {} BLOCK ADDED AS ALTERNATIVE ON HEIGHT {}\nid:\t{}\nPoW:\t{}\ndifficulty:\t{}", block_type, blk_height, id, blk_pow.proof_of_work, current_diff);
return true;
}
}
@ -2207,7 +2206,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
{
if (alt_chain_has_greater_pow)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {} with cum_difficulty {}\n alternative blockchain size: {} with cum_difficulty {}", alt_chain.front().height, m_db->height() - 1, m_db->get_block_cumulative_difficulty(m_db->height() - 1), alt_chain.size(), alt_data.cumulative_difficulty));
log::info(logcat, fg(fmt::terminal_color::green), "###### REORGANIZE on height: {} of {} with cum_difficulty {}\n alternative blockchain size: {} with cum_difficulty {}", alt_chain.front().height, m_db->height() - 1, m_db->get_block_cumulative_difficulty(m_db->height() - 1), alt_chain.size(), alt_data.cumulative_difficulty);
bool r = switch_to_alternative_blockchain(alt_chain, true);
if (r)
bvc.m_added_to_main_chain = true;
@ -2217,7 +2216,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
}
else
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "----- {} BLOCK ADDED AS ALTERNATIVE ON HEIGHT {}\nid:\t{}\nPoW:\t{}\ndifficulty:\t{}", block_type, blk_height, id, blk_pow.proof_of_work, current_diff));
log::info(logcat, fg(fmt::terminal_color::blue), "----- {} BLOCK ADDED AS ALTERNATIVE ON HEIGHT {}\nid:\t{}\nPoW:\t{}\ndifficulty:\t{}", block_type, blk_height, id, blk_pow.proof_of_work, current_diff);
return true;
}
}
@ -4150,7 +4149,7 @@ Blockchain::block_pow_verified Blockchain::verify_block_pow(cryptonote::block co
// validate proof_of_work versus difficulty target
result.valid = check_hash(result.proof_of_work, difficulty);
if (!result.valid)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "{} with id: {}\n does not have enough proof of work: {} at height {}, required difficulty: {}", (alt_block ? "Alternative block" : "Block"), blk_hash, result.proof_of_work, blk_height, difficulty));
log::info(logcat, fg(fmt::terminal_color::red), "{} with id: {}\n does not have enough proof of work: {} at height {}, required difficulty: {}", (alt_block ? "Alternative block" : "Block"), blk_hash, result.proof_of_work, blk_height, difficulty);
}
return result;
@ -4191,7 +4190,7 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
crypto::hash top_hash = get_tail_id();
if(blk.prev_id != top_hash)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {}, has wrong prev_id: {}, expected: {}", blk_hash, blk.prev_id, top_hash));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {}, has wrong prev_id: {}, expected: {}", blk_hash, blk.prev_id, top_hash);
return false;
}
@ -4203,11 +4202,13 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
if (auto now = std::chrono::steady_clock::now(); now > last_outdated_warning + 5min)
{
last_outdated_warning = now;
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "**********************************************************************"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "A block was seen on the network with a version higher than the last"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "known one. This may be an old version of the daemon, and a software"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "update may be required to sync further. Try running: update check"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "**********************************************************************"));
for (const auto* msg : {
"**********************************************************************",
"A block was seen on the network with a version higher than the last",
"known one. This may be an old version of the daemon, and a software",
"update may be required to sync further. Try running: update check",
"**********************************************************************"})
log::warning(logcat, fg(fmt::terminal_color::red), msg);
}
}
@ -4215,7 +4216,7 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
if (blk.major_version != required_major_version ||
(blk.major_version < hf::hf19_reward_batching && blk.minor_version < static_cast<uint8_t>(required_major_version)))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {}, has invalid version {}.{}; current: {}.{} for height {}", blk_hash, static_cast<int>(blk.major_version), +blk.minor_version, static_cast<int>(required_major_version), static_cast<int>(required_major_version), blk_height));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {}, has invalid version {}.{}; current: {}.{} for height {}", blk_hash, static_cast<int>(blk.major_version), +blk.minor_version, static_cast<int>(required_major_version), static_cast<int>(required_major_version), blk_height);
return false;
}
@ -4228,7 +4229,7 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
{
if (!service_node_checkpoint || (service_node_checkpoint && blk.major_version >= hf::hf13_enforce_checkpoints))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "CHECKPOINT VALIDATION FAILED"));
log::info(logcat, fg(fmt::terminal_color::red), "CHECKPOINT VALIDATION FAILED");
return false;
}
}
@ -4238,7 +4239,7 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
// number of the most recent blocks.
if(!check_block_timestamp(blk))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {}, has invalid timestamp: {}", blk_hash, blk.timestamp));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {}, has invalid timestamp: {}", blk_hash, blk.timestamp);
return false;
}
}
@ -4248,7 +4249,7 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block
// sanity check basic miner tx properties;
if(!prevalidate_miner_transaction(blk, alt_block ? blk_height : chain_height, hf_version))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {} failed to pass prevalidation", blk_hash));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {} failed to pass prevalidation", blk_hash);
return false;
}
@ -4338,7 +4339,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
if (m_db->tx_exists(tx_id))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {} attempting to add transaction already in blockchain with id: {}", id, tx_id));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {} attempting to add transaction already in blockchain with id: {}", id, tx_id);
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
return false;
@ -4350,7 +4351,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
// get transaction with hash <tx_id> from tx_pool
if(!m_tx_pool.take_tx(tx_id, tx_tmp, txblob, tx_weight, fee, relayed, do_not_relay, double_spend_seen))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {} has at least one unknown transaction with id: {}", id, tx_id));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {} has at least one unknown transaction with id: {}", id, tx_id);
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
return false;
@ -4388,11 +4389,11 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
tx_verification_context tvc{};
if(!check_tx_inputs(tx, tvc))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id: {} has at least one transaction (id: {}) with wrong inputs.", id, tx_id));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id: {} has at least one transaction (id: {}) with wrong inputs.", id, tx_id);
add_block_as_invalid(bl);
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block with id {} added as invalid because of wrong inputs in transactions", id));
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "tx_index {}, m_blocks_txs_check {}:", tx_index, m_blocks_txs_check.size()));
log::info(logcat, fg(fmt::terminal_color::red), "Block with id {} added as invalid because of wrong inputs in transactions", id);
log::info(logcat, fg(fmt::terminal_color::red), "tx_index {}, m_blocks_txs_check {}:", tx_index, m_blocks_txs_check.size());
for (const auto &h: m_blocks_txs_check)
log::error(log::Cat("verify"), " {}", h);
bvc.m_verifivation_failed = true;
@ -4428,7 +4429,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
uint64_t already_generated_coins = chain_height ? m_db->get_block_already_generated_coins(chain_height - 1) : 0;
if(!validate_miner_transaction(bl, cumulative_block_weight, fee_summary, base_reward, already_generated_coins, get_network_version()))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block {} with id: {} has incorrect miner transaction", (chain_height - 1), id));
log::info(logcat, fg(fmt::terminal_color::red), "Block {} with id: {} has incorrect miner transaction", (chain_height - 1), id);
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
return false;
@ -4464,7 +4465,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
}
catch (const KEY_IMAGE_EXISTS& e)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Error adding block with hash: {} to blockchain, what = {}", id, e.what()));
log::info(logcat, fg(fmt::terminal_color::red), "Error adding block with hash: {} to blockchain, what = {}", id, e.what());
m_batch_success = false;
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
@ -4473,7 +4474,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
catch (const std::exception& e)
{
//TODO: figure out the best way to deal with this failure
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Error adding block with hash: {} to blockchain, what = {}", id, e.what()));
log::info(logcat, fg(fmt::terminal_color::red), "Error adding block with hash: {} to blockchain, what = {}", id, e.what());
m_batch_success = false;
bvc.m_verifivation_failed = true;
return_tx_to_pool(txs);
@ -4482,7 +4483,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
}
else
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Blocks that failed verification should not reach here"));
log::info(logcat, fg(fmt::terminal_color::red), "Blocks that failed verification should not reach here");
}
auto abort_block = oxen::defer([&]() {
@ -4507,14 +4508,14 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
try {
m_service_node_list.block_add(bl, only_txs, checkpoint);
} catch (const std::exception& e) {
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Failed to add block to Service Node List: {}", e.what()));
log::info(logcat, fg(fmt::terminal_color::red), "Failed to add block to Service Node List: {}", e.what());
bvc.m_verifivation_failed = true;
return false;
}
if (!m_ons_db.add_block(bl, only_txs))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Failed to add block to ONS DB."));
log::info(logcat, fg(fmt::terminal_color::red), "Failed to add block to ONS DB.");
bvc.m_verifivation_failed = true;
return false;
}
@ -4537,7 +4538,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
try {
hook(hook_data);
} catch (const std::exception& e) {
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Block added hook failed with exception: ", e.what()));
log::info(logcat, fg(fmt::terminal_color::red), "Block added hook failed with exception: ", e.what());
bvc.m_verifivation_failed = true;
return false;
}
@ -4548,7 +4549,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
// do this after updating the hard fork state since the weight limit may change due to fork
if (!update_next_cumulative_weight_limit())
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Failed to update next cumulative weight limit"));
log::info(logcat, fg(fmt::terminal_color::red), "Failed to update next cumulative weight limit");
return false;
}

View File

@ -942,16 +942,16 @@ namespace cryptonote
}
if (m_service_node) {
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Service node public keys:"));
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "- primary: {}", tools::type_to_hex(keys.pub)));
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "- ed25519: {}", tools::type_to_hex(keys.pub_ed25519)));
log::info(logcat, fg(fmt::terminal_color::yellow), "Service node public keys:");
log::info(logcat, fg(fmt::terminal_color::yellow), "- primary: {}", tools::type_to_hex(keys.pub));
log::info(logcat, fg(fmt::terminal_color::yellow), "- ed25519: {}", tools::type_to_hex(keys.pub_ed25519));
// .snode address is the ed25519 pubkey, encoded with base32z and with .snode appended:
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "- lokinet: {}.snode", oxenc::to_base32z(tools::view_guts(keys.pub_ed25519))));
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "- x25519: {}", tools::type_to_hex(keys.pub_x25519)));
log::info(logcat, fg(fmt::terminal_color::yellow), "- lokinet: {}.snode", oxenc::to_base32z(tools::view_guts(keys.pub_ed25519)));
log::info(logcat, fg(fmt::terminal_color::yellow), "- x25519: {}", tools::type_to_hex(keys.pub_x25519));
} else {
// Only print the x25519 version because it's the only thing useful for a non-SN (for
// encrypted LMQ RPC connections).
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "x25519 public key: {}", tools::type_to_hex(keys.pub_x25519)));
log::info(logcat, fg(fmt::terminal_color::yellow), "x25519 public key: {}", tools::type_to_hex(keys.pub_x25519));
}
return true;
@ -2268,8 +2268,8 @@ namespace cryptonote
auto pubkey = m_service_node_list.get_pubkey_from_x25519(m_service_keys.pub_x25519);
if (pubkey != crypto::null_pkey && pubkey != m_service_keys.pub && m_service_node_list.is_service_node(pubkey, false /*don't require active*/))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red),
"Failed to submit uptime proof: another service node on the network is using the same ed/x25519 keys as this service node. This typically means both have the same 'key_ed25519' private key file."));
log::info(logcat, fg(fmt::terminal_color::red),
"Failed to submit uptime proof: another service node on the network is using the same ed/x25519 keys as this service node. This typically means both have the same 'key_ed25519' private key file.");
return;
}
@ -2284,7 +2284,7 @@ namespace cryptonote
if (pk != m_service_keys.pub && proof.proof->public_ip == m_sn_public_ip &&
(proof.proof->qnet_port == m_quorumnet_port || (
m_nettype != network_type::DEVNET && (proof.proof->storage_https_port == storage_https_port() || proof.proof->storage_omq_port == storage_omq_port()))))
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Another service node ({}) is broadcasting the same public IP and ports as this service node ({}:{}[qnet], :{}[SS-HTTP], :{}[SS-LMQ]). This will lead to deregistration of one or both service nodes if not corrected. (Do both service nodes have the correct IP for the service-node-public-ip setting?)", pk, epee::string_tools::get_ip_string_from_int32(m_sn_public_ip), proof.proof->qnet_port, proof.proof->storage_https_port, proof.proof->storage_omq_port));
log::info(logcat, fg(fmt::terminal_color::red), "Another service node ({}) is broadcasting the same public IP and ports as this service node ({}:{}[qnet], :{}[SS-HTTP], :{}[SS-LMQ]). This will lead to deregistration of one or both service nodes if not corrected. (Do both service nodes have the correct IP for the service-node-public-ip setting?)", pk, epee::string_tools::get_ip_string_from_int32(m_sn_public_ip), proof.proof->qnet_port, proof.proof->storage_https_port, proof.proof->storage_omq_port);
});
}
@ -2292,14 +2292,14 @@ namespace cryptonote
{
if (!check_external_ping(m_last_storage_server_ping, get_net_config().UPTIME_PROOF_FREQUENCY, "the storage server"))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red),
"Failed to submit uptime proof: have not heard from the storage server recently. Make sure that it is running! It is required to run alongside the Loki daemon"));
log::info(logcat, fg(fmt::terminal_color::red),
"Failed to submit uptime proof: have not heard from the storage server recently. Make sure that it is running! It is required to run alongside the Loki daemon");
return;
}
if (!check_external_ping(m_last_lokinet_ping, get_net_config().UPTIME_PROOF_FREQUENCY, "Lokinet"))
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red),
"Failed to submit uptime proof: have not heard from lokinet recently. Make sure that it is running! It is required to run alongside the Loki daemon"));
log::info(logcat, fg(fmt::terminal_color::red),
"Failed to submit uptime proof: have not heard from lokinet recently. Make sure that it is running! It is required to run alongside the Loki daemon");
return;
}
}
@ -2323,14 +2323,17 @@ namespace cryptonote
main_message = "The daemon is running offline and will not attempt to sync to the Loki network.";
else
main_message = "The daemon will start synchronizing with the network. This may take a long time to complete.";
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "\n**********************************************************************\n\
{}\n\n\
You can set the level of process detailization through \"set_log <level|categories>\" command,\n\
where <level> is between 0 (no details) and 4 (very verbose), or custom category based levels (eg, *:WARNING).\n\
\n\
Use the \"help\" command to see the list of available commands.\n\
Use \"help <command>\" to see a command's documentation.\n\
**********************************************************************\n", main_message));
log::info(logcat, fg(fmt::terminal_color::yellow), R"(
**********************************************************************
{}
You can set the level of process detailization through "set_log <level|categories>" command,
where <level> is between 0 (no details) and 4 (very verbose), or custom category based levels (eg, *:WARNING).
Use the "help" command to see the list of available commands.
Use "help <command>" to see a command's documentation.
**********************************************************************
)", main_message);
m_starter_message_showed = true;
}
@ -2361,7 +2364,7 @@ Use \"help <command>\" to see a command's documentation.\n\
{
uint64_t free_space = get_free_space();
if (free_space < 1ull * 1024 * 1024 * 1024) // 1 GB
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "Free space is below 1 GB on {}", m_config_folder));
log::warning(logcat, fg(fmt::terminal_color::red), "Free space is below 1 GB on {}", m_config_folder);
return true;
}
//-----------------------------------------------------------------------------------------------

View File

@ -740,7 +740,7 @@ namespace service_nodes
switch (state_change.state) {
case new_state::deregister:
if (is_me)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Deregistration for service node (yours): {}", key));
log::info(logcat, fg(fmt::terminal_color::red), "Deregistration for service node (yours): {}", key);
else
log::info(logcat, "Deregistration for service node: {}", key);
@ -774,7 +774,7 @@ namespace service_nodes
}
if (is_me)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Temporary decommission for service node (yours): {}", key));
log::info(logcat, fg(fmt::terminal_color::red), "Temporary decommission for service node (yours): {}", key);
else
log::info(logcat, "Temporary decommission for service node: {}", key);
@ -812,7 +812,7 @@ namespace service_nodes
}
if (is_me)
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Recommission for service node (yours): {}", key));
log::info(logcat, fg(fmt::terminal_color::green), "Recommission for service node (yours): {}", key);
else
log::info(logcat, "Recommission for service node: {}", key);
@ -857,7 +857,7 @@ namespace service_nodes
}
if (is_me)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Reward position reset for service node (yours): {}", key));
log::info(logcat, fg(fmt::terminal_color::red), "Reward position reset for service node (yours): {}", key);
else
log::info(logcat, "Reward position reset for service node: {}", key);
@ -1144,7 +1144,7 @@ namespace service_nodes
}
if (my_keys && my_keys->pub == key)
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Service node registered (yours): {} on height: {}", key, block_height));
log::info(logcat, fg(fmt::terminal_color::green), "Service node registered (yours): {} on height: {}", key, block_height);
else
log::info(logcat, "New service node registered: {} on height: {}", key, block_height);
}
@ -1178,11 +1178,11 @@ namespace service_nodes
{
if (registered_during_grace_period)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Service node re-registered (yours): {} at block height: {}", key, block_height));
log::info(logcat, fg(fmt::terminal_color::green), "Service node re-registered (yours): {} at block height: {}", key, block_height);
}
else
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Service node registered (yours): {} at block height: {}", key, block_height));
log::info(logcat, fg(fmt::terminal_color::green), "Service node registered (yours): {} at block height: {}", key, block_height);
}
}
else
@ -2193,7 +2193,7 @@ namespace service_nodes
if (i != service_nodes_infos.end())
{
if (my_keys && my_keys->pub == pubkey)
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Service node expired (yours): {} at block height: {}", pubkey, block_height));
log::info(logcat, fg(fmt::terminal_color::green), "Service node expired (yours): {} at block height: {}", pubkey, block_height);
else
log::info(logcat, "Service node expired: {} at block height: {}", pubkey, block_height);
@ -3176,7 +3176,7 @@ namespace service_nodes
log::debug(logcat, "Accepted uptime proof from {}", proof.pubkey);
if (m_service_node_keys && proof.pubkey_ed25519 == m_service_node_keys->pub_ed25519)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Uptime proof from SN {} is not us, but is using our ed/x25519 keys; this is likely to lead to deregistration of one or both service nodes.", proof.pubkey));
log::info(logcat, fg(fmt::terminal_color::red), "Uptime proof from SN {} is not us, but is using our ed/x25519 keys; this is likely to lead to deregistration of one or both service nodes.", proof.pubkey);
}
auto old_x25519 = iproof.pubkey_x25519;
@ -3305,7 +3305,7 @@ namespace service_nodes
log::debug(logcat, "Accepted uptime proof from {}", proof->pubkey);
if (m_service_node_keys && proof->pubkey_ed25519 == m_service_node_keys->pub_ed25519)
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "Uptime proof from SN {} is not us, but is using our ed/x25519 keys; this is likely to lead to deregistration of one or both service nodes.", proof->pubkey));
log::info(logcat, fg(fmt::terminal_color::red), "Uptime proof from SN {} is not us, but is using our ed/x25519 keys; this is likely to lead to deregistration of one or both service nodes.", proof->pubkey);
}
auto old_x25519 = iproof.pubkey_x25519;

View File

@ -331,7 +331,7 @@ namespace cryptonote
if (version != hshd.top_version)
{
if (version < hshd.top_version && version == get_network_version(nettype, m_core.get_current_blockchain_height()))
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "{} peer claims higher version than we think ({} for {} instead of {}) 0 we may be forked from the network and a software upgrade may be needed", context, (unsigned)hshd.top_version, (hshd.current_height - 1), (unsigned)version));
log::warning(logcat, fg(fmt::terminal_color::red), "{} peer claims higher version than we think ({} for {} instead of {}) 0 we may be forked from the network and a software upgrade may be needed", context, (unsigned)hshd.top_version, (hshd.current_height - 1), (unsigned)version);
return false;
}
}
@ -448,7 +448,7 @@ namespace cryptonote
uint64_t max_block_height = std::max(hshd.current_height, curr_height);
std::string sync_msg = fmt::format("{}Sync data returned a new top block candidate: {} -> {} [Your node is {} blocks ({} {})]\nSYNCHRONIZATION started", context, curr_height, hshd.current_height, abs_diff, tools::get_human_readable_timespan(abs_diff*TARGET_BLOCK_TIME), (0 <= diff ? "behind" : "ahead"));
if (is_initial)
log::info(globallogcat, fmt::format(fg(fmt::terminal_color::cyan), sync_msg));
log::info(globallogcat, fg(fmt::terminal_color::cyan), sync_msg);
else
log::debug(globallogcat, sync_msg);
@ -1220,7 +1220,7 @@ namespace cryptonote
}
{
log::debug(globallogcat, fmt::format(fg(fmt::terminal_color::yellow), "{} Got NEW BLOCKS inside of {}: size: {}, blocks: {} - {} (pruning seed {})", context, __FUNCTION__, arg.blocks.size(), start_height, (start_height + arg.blocks.size() - 1), epee::string_tools::to_string_hex(context.m_pruning_seed)));
log::debug(globallogcat, fg(fmt::terminal_color::yellow), "{} Got NEW BLOCKS inside of {}: size: {}, blocks: {} - {} (pruning seed {})", context, __FUNCTION__, arg.blocks.size(), start_height, (start_height + arg.blocks.size() - 1), epee::string_tools::to_string_hex(context.m_pruning_seed));
// add that new span to the block queue
seconds_f dt = now - request_time;
@ -1561,7 +1561,7 @@ namespace cryptonote
+ std::to_string(previous_stripe) + " -> " + std::to_string(current_stripe);
if (OXEN_LOG_ENABLED(debug))
timing_message += std::string(": ") + m_block_queue.get_overview(current_blockchain_height);
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Synced {}/{} {} {}", current_blockchain_height, target_blockchain_height, progress_message, timing_message));
log::info(logcat, fg(fmt::terminal_color::yellow), "Synced {}/{} {} {}", current_blockchain_height, target_blockchain_height, progress_message, timing_message);
if (previous_stripe != current_stripe)
notify_new_stripe(context, current_stripe);
}
@ -2226,7 +2226,7 @@ skip:
{
if (m_core.get_current_blockchain_height() >= m_core.get_target_blockchain_height())
{
log::info(globallogcat, fmt::format(fg(fmt::terminal_color::green), "SYNCHRONIZED OK"));
log::info(globallogcat, fg(fmt::terminal_color::green), "SYNCHRONIZED OK");
on_connection_synchronized();
}
}
@ -2255,22 +2255,24 @@ skip:
if (synced_seconds == 0s)
synced_seconds = 1s;
float blocks_per_second = synced_blocks / (float)synced_seconds.count();
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Synced {} blocks in {} ({} blocks per second)", synced_blocks, tools::get_human_readable_timespan(synced_seconds), blocks_per_second));
log::info(logcat, fg(fmt::terminal_color::yellow), "Synced {} blocks in {} ({} blocks per second)", synced_blocks, tools::get_human_readable_timespan(synced_seconds), blocks_per_second);
}
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "\n**********************************************************************\n\
You are now synchronized with the network. You may now start oxen-wallet-cli.\n\
\n\
Use the \"help\" command to see the list of available commands.\n\
**********************************************************************"));
log::info(logcat, fg(fmt::terminal_color::yellow), R"(
**********************************************************************
You are now synchronized with the network. You may now start oxen-wallet-cli.
Use the "help" command to see the list of available commands.
**********************************************************************)");
if (OXEN_LOG_ENABLED(info))
{
const std::chrono::duration<double> sync_time{std::chrono::steady_clock::now() - m_sync_timer};
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Sync time: {:.0f} min, {} + {} MB downloaded, {}% old spans, {}% bad spans", sync_time.count()/1e9/60,
(10 * m_sync_download_objects_size / 1024 / 1024) / 10.f,
(10 * m_sync_download_chain_size / 1024 / 1024) / 10.f,
100.0f * m_sync_old_spans_downloaded / m_sync_spans_downloaded,
100.0f * m_sync_bad_spans_downloaded / m_sync_spans_downloaded));
log::info(logcat, fg(fmt::terminal_color::yellow), "Sync time: {:.1f} min, {:.1f} + {:.1f} MB downloaded, {:.2f}% old spans, {:.2f}% bad spans",
sync_time.count()/60.0,
m_sync_download_objects_size / 1000.0 / 1000.0,
m_sync_download_chain_size / 1000.0 / 1000.0,
100.0 * m_sync_old_spans_downloaded / m_sync_spans_downloaded,
100.0 * m_sync_bad_spans_downloaded / m_sync_spans_downloaded);
}
m_core.on_synchronized();
}
@ -2611,7 +2613,7 @@ Use the \"help\" command to see the list of available commands.\n\
log::info(logcat, "Target height decreasing from {} to {}", previous_target, target);
m_core.set_target_blockchain_height(target);
if (target == 0 && context.m_state > cryptonote_connection_context::state_before_handshake && !m_stopping)
log::warning(logcat, fmt::format(fg(fmt::terminal_color::yellow), "oxend is now disconnected from the network"));
log::warning(logcat, fg(fmt::terminal_color::yellow), "oxend is now disconnected from the network");
}
m_block_queue.flush_spans(context.m_connection_id, false);

View File

@ -111,7 +111,7 @@ daemon::daemon(boost::program_options::variables_map vm_) :
p2p{std::make_unique<node_server>(*protocol)},
rpc{std::make_unique<cryptonote::rpc::core_rpc_server>(*core, *p2p)}
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "Initializing daemon objects..."));
log::info(logcat, fg(fmt::terminal_color::blue), "Initializing daemon objects...");
log::info(logcat, "- cryptonote protocol");
if (!protocol->init(vm))
@ -146,7 +146,7 @@ daemon::daemon(boost::program_options::variables_map vm_) :
std::vector<std::tuple<std::string, uint16_t, bool>> rpc_listen_admin, rpc_listen_public;
if (deprecated_rpc_options)
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::red), "{} options are deprecated and will be removed from a future oxend version; use --rpc-public/--rpc-admin instead", deprecated_option_names));
log::info(logcat, fg(fmt::terminal_color::red), "{} options are deprecated and will be removed from a future oxend version; use --rpc-public/--rpc-admin instead", deprecated_option_names);
// These old options from Monero are really janky: --restricted-rpc turns the main port
// restricted, but then we also have --rpc-restricted-bind-port but both are stuck with
@ -219,12 +219,12 @@ daemon::daemon(boost::program_options::variables_map vm_) :
http_rpc_public.emplace(*rpc, rpc_config, true /*restricted*/, std::move(rpc_listen_public));
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "Done daemon object initialization"));
log::info(logcat, fg(fmt::terminal_color::blue), "Done daemon object initialization");
}
daemon::~daemon()
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "Deinitializing daemon objects..."));
log::info(logcat, fg(fmt::terminal_color::blue), "Deinitializing daemon objects...");
if (http_rpc_public) {
log::info(logcat, "- public HTTP RPC server");
@ -257,7 +257,7 @@ daemon::~daemon()
} catch (const std::exception& e) {
log::error(logcat, "Failed to stop cryptonote protocol: {}", e.what());
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "Deinitialization complete"));
log::info(logcat, fg(fmt::terminal_color::blue), "Deinitialization complete");
}
void daemon::init_options(boost::program_options::options_description& option_spec, boost::program_options::options_description& hidden)
@ -298,7 +298,7 @@ bool daemon::run(bool interactive)
try
{
log::info(logcat, fmt::format(fg(fmt::terminal_color::blue), "Starting up oxend services..."));
log::info(logcat, fg(fmt::terminal_color::blue), "Starting up oxend services...");
cryptonote::GetCheckpointsCallback get_checkpoints;
#if defined(PER_BLOCK_CHECKPOINT)
get_checkpoints = blocks::GetCheckpointsData;
@ -342,14 +342,14 @@ bool daemon::run(bool interactive)
rpc_commands->start_handling([this] { stop(); });
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Starting up main network"));
log::info(logcat, fg(fmt::terminal_color::green), "Starting up main network");
#ifdef ENABLE_SYSTEMD
sd_notify(0, ("READY=1\nSTATUS=" + core->get_status_string()).c_str());
#endif
p2p->run(); // blocks until p2p goes down
log::info(logcat, fmt::format(fg(fmt::terminal_color::yellow), "Main network stopped"));
log::info(logcat, fg(fmt::terminal_color::yellow), "Main network stopped");
if (rpc_commands)
{

View File

@ -167,7 +167,7 @@ namespace nodetool
if (now >= it->second)
{
m_blocked_hosts.erase(it);
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Host {} unblocked.", address.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Host {} unblocked.", address.host_str());
it = m_blocked_hosts.end();
}
else
@ -188,7 +188,7 @@ namespace nodetool
if (now >= it->second)
{
it = m_blocked_subnets.erase(it);
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Subnet {} unblocked", it->first.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Subnet {} unblocked", it->first.host_str());
continue;
}
if (it->first.matches(ipv4_address))
@ -241,7 +241,7 @@ namespace nodetool
conns.clear();
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Host {} blocked", addr.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Host {} blocked", addr.host_str());
return true;
}
//-----------------------------------------------------------------------------------
@ -253,7 +253,7 @@ namespace nodetool
if (i == m_blocked_hosts.end())
return false;
m_blocked_hosts.erase(i);
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Host {} unblocked", address.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Host {} unblocked", address.host_str());
return true;
}
//-----------------------------------------------------------------------------------
@ -293,7 +293,7 @@ namespace nodetool
conns.clear();
}
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Subnet {} blocked.", subnet.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Subnet {} blocked.", subnet.host_str());
return true;
}
//-----------------------------------------------------------------------------------
@ -305,7 +305,7 @@ namespace nodetool
if (i == m_blocked_subnets.end())
return false;
m_blocked_subnets.erase(i);
log::info(logcat, fmt::format(fg(fmt::terminal_color::cyan), "Subnet {}", subnet.host_str()));
log::info(logcat, fg(fmt::terminal_color::cyan), "Subnet {}", subnet.host_str());
return true;
}
//-----------------------------------------------------------------------------------
@ -718,11 +718,11 @@ namespace nodetool
}
m_listening_port = public_zone.m_net_server.get_binded_port();
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Net service bound (IPv4) to {}:{}", public_zone.m_bind_ip, m_listening_port));
log::info(logcat, fg(fmt::terminal_color::green), "Net service bound (IPv4) to {}:{}", public_zone.m_bind_ip, m_listening_port);
if (m_use_ipv6)
{
m_listening_port_ipv6 = public_zone.m_net_server.get_binded_port_ipv6();
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), "Net service bound (IPv6) to {}:{}", public_zone.m_bind_ipv6_address, m_listening_port_ipv6));
log::info(logcat, fg(fmt::terminal_color::green), "Net service bound (IPv6) to {}:{}", public_zone.m_bind_ipv6_address, m_listening_port_ipv6);
}
if(m_external_port)
log::debug(logcat, "External port defined as {}", m_external_port);
@ -1681,7 +1681,7 @@ namespace nodetool
}
else
{
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "No incoming connections - check firewalls/routers allow port {}", get_this_peer_port()));
log::warning(logcat, fg(fmt::terminal_color::red), "No incoming connections - check firewalls/routers allow port {}", get_this_peer_port());
}
}
return true;

View File

@ -2662,7 +2662,7 @@ namespace cryptonote::rpc {
bool significant = std::chrono::seconds{now - old} > lifetime; // Print loudly for the first ping after startup/expiry
auto msg = fmt::format("Received ping from {} {}.{}.{}", name, cur_version[0], cur_version[1], cur_version[2]);
if (significant)
log::info(logcat, fmt::format(fg(fmt::terminal_color::green), msg));
log::info(logcat, fg(fmt::terminal_color::green), "{}", msg);
else
log::debug(logcat, msg);
success(significant);

View File

@ -2484,10 +2484,10 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
if (total_received_1 != total_received_2)
{
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "**********************************************************************"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "Consistency failure in amounts received"));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "Check transaction {}", txid));
log::warning(logcat, fmt::format(fg(fmt::terminal_color::red), "**********************************************************************"));
log::warning(logcat, fg(fmt::terminal_color::red), "**********************************************************************");
log::warning(logcat, fg(fmt::terminal_color::red), "Consistency failure in amounts received");
log::warning(logcat, fg(fmt::terminal_color::red), "Check transaction {}", txid);
log::warning(logcat, fg(fmt::terminal_color::red), "**********************************************************************");
exit(1);
return;
}