From 58c70115f2f963c8eeeb060735eb520acfbc8cae Mon Sep 17 00:00:00 2001 From: auruya Date: Mon, 20 Oct 2025 15:25:09 +0300 Subject: [PATCH] fix compiler warnings --- .../blockchain_scanner.cpp | 19 ++++++++------- src/carrot_core/scan.cpp | 1 - src/cryptonote_core/blockchain.cpp | 24 +++++++++---------- src/p2p/net_node.inl | 3 +-- src/rpc/core_rpc_server.cpp | 1 - src/wallet/tx_builder.cpp | 11 ++++----- src/wallet/wallet2.cpp | 19 ++++++--------- src/wallet/wallet_rpc_payments.cpp | 2 +- 8 files changed, 35 insertions(+), 45 deletions(-) diff --git a/src/blockchain_utilities/blockchain_scanner.cpp b/src/blockchain_utilities/blockchain_scanner.cpp index 91e48f874..78d40a684 100644 --- a/src/blockchain_utilities/blockchain_scanner.cpp +++ b/src/blockchain_utilities/blockchain_scanner.cpp @@ -214,9 +214,9 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, '' #define MAX_RINGS 0xffffffff struct tm prevtm = {0}, currtm; - uint64_t currsz = 0; - uint64_t currtxs = 0; - uint64_t currblks = 0; + // uint64_t currsz = 0; + // uint64_t currtxs = 0; + // uint64_t currblks = 0; const std::map>> audit_hard_forks = get_config(net_type).AUDIT_HARD_FORKS; @@ -244,7 +244,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, '' prevtm = currtm; } skip: - currsz += bd.size(); + // currsz += bd.size(); std::set used_assets, miner_tx_assets, protocol_tx_assets; std::map> used_tx_versions; used_assets.insert("SAL"); @@ -321,10 +321,11 @@ skip: std::cout << timebuf << "" << delimiter << "" << h << "" << delimiter << "" << tx_id << "" << delimiter << "invalid TX detected" << delimiter << std::endl; continue; } - currsz += bd.size(); - if (db->get_prunable_tx_blob(tx_id, bd)) - currsz += bd.size(); - currtxs++; + // currsz += bd.size(); + // if (db->get_prunable_tx_blob(tx_id, bd)) + // currsz += bd.size(); + // currtxs++; + db->get_prunable_tx_blob(tx_id, bd); if (tx.type != cryptonote::transaction_type::TRANSFER && tx.type != cryptonote::transaction_type::BURN && @@ -370,7 +371,7 @@ skip: } } - currblks++; + // currblks++; if (stop_requested) break; diff --git a/src/carrot_core/scan.cpp b/src/carrot_core/scan.cpp index 91936fdae..9d5f23c58 100644 --- a/src/carrot_core/scan.cpp +++ b/src/carrot_core/scan.cpp @@ -496,7 +496,6 @@ bool try_scan_carrot_enote_internal_receiver(const CarrotEnoteV1 &enote, input_context, s_sender_receiver); - bool normal_change_found = true; if (!try_scan_carrot_enote_internal_burnt(enote, s_sender_receiver, sender_extension_g_out, diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 0a7a63332..e4f30e08f 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -976,11 +976,11 @@ size_t Blockchain::recalculate_difficulties(boost::optional start_heig if (start_height_opt) { start_height = *start_height_opt; } else { - bool found = false; + // bool found; for (size_t i=0; iget_current_version(); + // const uint8_t hf_version = m_hardfork->get_current_version(); epee::net_utils::http::http_simple_client http_client; COMMAND_RPC_GET_PRICING_RECORD::request req = AUTO_VAL_INIT(req); @@ -4518,8 +4517,7 @@ void Blockchain::get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_block //------------------------------------------------------------------ uint64_t Blockchain::get_dynamic_base_fee_estimate(uint64_t grace_blocks) const { - const uint8_t version = get_current_hard_fork_version(); - const uint64_t db_height = m_db->height(); + // const uint64_t db_height = m_db->height(); if (grace_blocks >= CRYPTONOTE_REWARD_BLOCKS_WINDOW) grace_blocks = CRYPTONOTE_REWARD_BLOCKS_WINDOW - 1; @@ -4670,7 +4668,7 @@ bool Blockchain::calculate_audit_payouts(const uint64_t start_height, std::vecto // Get the AUDIT TX information for matured staked coins std::vector audit_entries; // We get the audit_tx_info from the block where they entered the chain - int audit_tx_result = m_db->get_audit_tx_info(start_height, audit_entries); + m_db->get_audit_tx_info(start_height, audit_entries); if (!audit_entries.size()) { // Report error and abort @@ -4723,7 +4721,7 @@ bool Blockchain::calculate_yield_payouts(const uint64_t start_height, std::vecto // Get the YIELD TX information for matured staked coins std::vector yield_entries; // We get the yield_tx_info from the block _before_ they started to accrue yield - int yield_tx_result = m_db->get_carrot_yield_tx_info(start_height, yield_entries); + m_db->get_carrot_yield_tx_info(start_height, yield_entries); if (!yield_entries.size()) { // Report error and abort @@ -4789,7 +4787,7 @@ bool Blockchain::calculate_yield_payouts(const uint64_t start_height, std::vecto // Get the YIELD TX information for matured staked coins std::vector yield_entries; // We get the yield_tx_info from the block _before_ they started to accrue yield - int yield_tx_result = m_db->get_yield_tx_info(start_height, yield_entries); + m_db->get_yield_tx_info(start_height, yield_entries); if (!yield_entries.size()) { // Report error and abort @@ -5406,7 +5404,7 @@ leave: // Update the YBI cache data uint64_t yield_lock_period = cryptonote::get_config(m_nettype).STAKE_LOCK_PERIOD; - uint64_t ybi_cache_expected_size = std::min(new_height, yield_lock_period); + // uint64_t ybi_cache_expected_size = std::min(new_height, yield_lock_period); if (new_height > yield_lock_period) { if (m_yield_block_info_cache.count(new_height - yield_lock_period - 2) != 0) { m_yield_block_info_cache.erase(new_height - yield_lock_period - 2); @@ -5524,7 +5522,7 @@ uint64_t Blockchain::get_next_long_term_block_weight(uint64_t block_weight) cons const uint64_t db_height = m_db->height(); const uint64_t nblocks = std::min(m_long_term_block_weights_window, db_height); - const uint8_t hf_version = get_current_hard_fork_version(); + // const uint8_t hf_version = get_current_hard_fork_version(); if (db_height < CRYPTONOTE_LONG_TERM_BLOCK_WEIGHT_WINDOW_SIZE) return block_weight; @@ -6171,7 +6169,7 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::vector ips; @@ -2074,7 +2074,6 @@ namespace nodetool continue; } MWARNING("Invalid IP address or subnet from DNS blocklist: " << ip << " - " << parsed_addr.error()); - ++bad; } } if (good > 0) diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 3f58381aa..17548241c 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -3125,7 +3125,6 @@ namespace cryptonote CHECK_PAYMENT(req, res, COST_PER_FEE_ESTIMATE); - const uint8_t version = m_core.get_blockchain_storage().get_current_hard_fork_version(); m_core.get_blockchain_storage().get_dynamic_base_fee_estimate_2021_scaling(req.grace_blocks, res.fees); res.fee = res.fees[0]; res.quantization_mask = Blockchain::get_fee_quantization_mask(); diff --git a/src/wallet/tx_builder.cpp b/src/wallet/tx_builder.cpp index a0f8854dd..7ba213d95 100644 --- a/src/wallet/tx_builder.cpp +++ b/src/wallet/tx_builder.cpp @@ -349,7 +349,7 @@ std::vector get_sources( w.get_outs(outs, selected_transfers, fake_outputs_count, true, valid_public_keys_cache); // may throw LOG_PRINT_L2("preparing outputs"); - size_t i = 0, out_index = 0; + size_t out_index = 0; std::vector sources; for(size_t idx: selected_transfers) { @@ -390,7 +390,6 @@ std::vector get_sources( oe.second.mask = std::get<2>(outs[out_index][n]); src.outputs.push_back(oe); } - ++i; //paste real transaction to the random index auto it_to_replace = std::find_if(src.outputs.begin(), src.outputs.end(), [&](const tx_output_entry& a) @@ -1097,14 +1096,14 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details( const auto &sources = tx_proposal.sources; // inputs - uint64_t amount_in = 0; + // uint64_t amount_in = 0; rct::carrot_ctkeyV inSk; inSk.reserve(sources.size()); std::vector inamounts; std::vector index; for (const auto& src: sources) { - amount_in += src.amount; + // amount_in += src.amount; inamounts.push_back(src.amount); index.push_back(src.real_output); @@ -1153,7 +1152,7 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details( } // outputs - uint64_t amount_out = 0; + // uint64_t amount_out = 0; std::vector outamounts; rct::keyV destinations; std::vector destination_asset_types; @@ -1163,7 +1162,7 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details( destinations.push_back(rct::pk2rct(oep.enote.onetime_address)); destination_asset_types.push_back(oep.enote.asset_type); outamounts.push_back(oep.amount); - amount_out += oep.amount; + // amount_out += oep.amount; rct::ctkey key; key.mask = rct::sk2rct(oep.amount_blinding_factor); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 0a5bd2b7c..8efdc2f3c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3371,11 +3371,9 @@ void wallet2::process_parsed_blocks(const uint64_t start_height, const std::vect tools::threadpool& tpool = tools::threadpool::getInstanceForCompute(); - size_t num_txes = 0; size_t num_tx_outputs = 0; for (const parsed_block &par_blk : parsed_blocks) { - num_txes += 2 + par_blk.txes.size(); num_tx_outputs += par_blk.block.miner_tx.vout.size(); num_tx_outputs += par_blk.block.protocol_tx.vout.size(); for (const cryptonote::transaction &tx : par_blk.txes) @@ -4164,7 +4162,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo // "I had to reorder some code to fix... a timing info leak IIRC. In turn, this undid something I had fixed before, ... a subtle race condition with the txpool. // It was pretty subtle IIRC, and so I needed time to think about how to refix it after the move, and I never got to it." // https://github.com/monero-project/monero/pull/6097 - bool refreshed = false; + // bool refreshed = false; std::map, size_t> output_tracker_cache = create_output_tracker_cache(); hw::device &hwdev = m_account.get_device(); @@ -7290,7 +7288,6 @@ std::map>> wallet2:: { std::map>> amount_per_subaddr; const uint64_t blockchain_height = get_blockchain_current_height(); - const uint64_t now = time(NULL); if (m_transfers_indices.count(asset_type) == 0) { return amount_per_subaddr; } @@ -9962,7 +9959,7 @@ void wallet2::get_outs(std::vector> outs.back().reserve(fake_outputs_count + 1); const rct::key mask = td.is_rct() ? rct::commit(td.amount(), td.m_mask) : rct::zeroCommit(td.amount()); - uint64_t num_outs = 0; + num_outs = 0; const uint64_t amount = td.is_rct() ? 0 : td.amount(); const bool output_is_pre_fork = td.m_block_height < segregation_fork_height; if (is_after_segregation_fork && m_segregate_pre_fork_outputs && output_is_pre_fork) @@ -10145,7 +10142,7 @@ void wallet2::transfer_selected(const std::vector sources; for(size_t idx: selected_transfers) { @@ -10164,7 +10161,6 @@ void wallet2::transfer_selected(const std::vector(outs[out_index][n]); src.outputs.push_back(oe); - ++i; } //paste real transaction to the random index @@ -10399,7 +10395,7 @@ void wallet2::transfer_selected_rct(std::vector sources; for(size_t idx: selected_transfers) { @@ -10437,7 +10433,6 @@ void wallet2::transfer_selected_rct(std::vector(outs[out_index][n]); src.outputs.push_back(oe); } - ++i; //paste real transaction to the random index auto it_to_replace = std::find_if(src.outputs.begin(), src.outputs.end(), [&](const tx_output_entry& a) @@ -11042,7 +11037,7 @@ std::vector wallet2::create_transactions_2(std::vector(tx_type)); + THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Invalid tx type specified: " + std::to_string(static_cast(tx_type))); break; } @@ -11712,8 +11707,8 @@ std::vector wallet2::create_transactions_all(uint64_t below const bool bulletproof = true; const bool bulletproof_plus = true; const bool clsag = true; - const bool use_fullproofs = use_fork_rules(get_full_proofs_fork(), 0); - const bool use_salviumone_proofs = use_fork_rules(get_salvium_one_proofs_fork(), 0); + //const bool use_fullproofs = use_fork_rules(get_full_proofs_fork(), 0); + //const bool use_salviumone_proofs = use_fork_rules(get_salvium_one_proofs_fork(), 0); //const rct::RCTConfig rct_config { rct::RangeProofPaddedBulletproof, use_salviumone_proofs ? 6 : use_fullproofs ? 5 : 4 }; const bool use_view_tags = use_fork_rules(get_view_tag_fork(), 0); const uint64_t base_fee = get_base_fee(priority); diff --git a/src/wallet/wallet_rpc_payments.cpp b/src/wallet/wallet_rpc_payments.cpp index 1a4123a50..d1852ffb4 100644 --- a/src/wallet/wallet_rpc_payments.cpp +++ b/src/wallet/wallet_rpc_payments.cpp @@ -152,7 +152,7 @@ bool wallet2::search_for_rpc_payment(uint64_t credits_target, uint32_t n_threads { tpool.submit(&waiter, [&, i] { *(uint32_t*)(hashing_blob.data() + 39) = SWAP32LE(local_nonce-i); - const uint8_t major_version = hashing_blob[0]; + // const uint8_t major_version = hashing_blob[0]; crypto::rx_slow_hash(seed_hash.data, hashing_blob.data(), hashing_blob.size(), hash[i].data); }); }