Remove unused variables in monero codebase

There are quite a few variables in the code that are no longer
(or perhaps never were) in use. These were discovered by enabling
compiler warnings for unused variables and cleaning them up.

In most cases where the unused variables were the result
of a function call the call was left but the variable
assignment removed, unless it was obvious that it was
a simple getter with no side effects.
This commit is contained in:
Kevin Barbour 2021-01-23 10:38:50 +01:00
parent cb70ae9450
commit 85db1734e7
No known key found for this signature in database
GPG key ID: 2AFF1519F7FE5333
34 changed files with 15 additions and 81 deletions

View file

@ -78,8 +78,6 @@ bool test_transaction_generation_and_ring_signature()
tx_source_entry& src = sources.back();
src.amount = 70368744177663;
{
tx_output_entry oe;
src.push_output(0, boost::get<txout_to_key>(tx_mine_1.vout[0].target).key, src.amount);
src.push_output(1, boost::get<txout_to_key>(tx_mine_2.vout[0].target).key, src.amount);

View file

@ -165,9 +165,6 @@ bool txpool_double_spend_base::timestamp_change_pause(cryptonote::core& /*c*/, s
bool txpool_double_spend_base::check_changed(cryptonote::core& c, const size_t ev_index, relay_test condition)
{
const std::size_t public_hash_count = m_broadcasted_hashes.size();
const std::size_t all_hash_count = m_all_hashes.size();
const std::size_t new_broadcasted_hash_count = m_broadcasted_hashes.size() + unsigned(condition == relay_test::broadcasted);
const std::size_t new_all_hash_count = m_all_hashes.size() + unsigned(condition == relay_test::hidden) + unsigned(condition == relay_test::no_relay);

View file

@ -41,7 +41,6 @@ using namespace cryptonote;
namespace
{
uint64_t const TEST_FEE = 5000000000; // 5 * 10^9
uint64_t const TEST_DUST_THRESHOLD = 5000000000; // 5 * 10^9
}
std::string generate_random_wallet_name()

View file

@ -169,7 +169,7 @@ namespace
LOG_PRINT_L0("Closing connections. Number of opened connections: " << m_tcp_server.get_config_object().get_connections_count());
size_t count = 0;
bool r = m_tcp_server.get_config_object().foreach_connection([&](test_connection_context& ctx) {
m_tcp_server.get_config_object().foreach_connection([&](test_connection_context& ctx) {
if (ctx.m_connection_id != cmd_conn_id)
{
++count;

View file

@ -215,7 +215,6 @@ void run_test(const std::string &filter, Params &params, const char* test_name)
if (params.stats)
{
uint64_t mins = min / scale;
uint64_t maxs = max / scale;
uint64_t meds = med / scale;
uint64_t p95s = quantiles[9] / scale;
uint64_t stddevs = stddev / scale;

View file

@ -296,7 +296,6 @@ TEST(bulletproof, weight_pruned)
ASSERT_TRUE(tx.version == 2);
ASSERT_FALSE(tx.pruned);
ASSERT_TRUE(rct::is_rct_bulletproof(tx.rct_signatures.type));
const uint64_t tx_size = bd.size();
const uint64_t tx_weight = cryptonote::get_transaction_weight(tx);
ASSERT_TRUE(parse_and_validate_tx_base_from_blob(bd, pruned_tx));
ASSERT_TRUE(pruned_tx.version == 2);

View file

@ -432,7 +432,6 @@ TEST(voting, info)
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
static const uint8_t block_versions[] = { 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4 };
static const uint8_t expected_versions[] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4 };
static const uint8_t expected_thresholds[] = { 0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 2, 2, 2, 2 };
for (uint64_t h = 0; h < sizeof(block_versions) / sizeof(block_versions[0]); ++h) {

View file

@ -250,7 +250,6 @@ TEST(ban, subnet)
TEST(ban, ignores_port)
{
time_t seconds;
test_core pr_core;
cryptonote::t_cryptonote_protocol_handler<test_core> cprotocol(pr_core, NULL);
Server server(cprotocol);

View file

@ -206,7 +206,7 @@ TEST(select_outputs, same_distribution)
for (size_t i = 0; i < chain_picks.size(); ++i)
chain_norm[i * 100 / chain_picks.size()] += chain_picks[i];
double max_dev = 0.0, avg_dev = 0.0;
double avg_dev = 0.0;
for (size_t i = 0; i < 100; ++i)
{
const double diff = (double)output_norm[i] - (double)chain_norm[i];

View file

@ -202,7 +202,6 @@ namespace
MASSERT(!expected.empty());
std::size_t actual_height = 0;
crypto::hash actual_id{};
crypto::hash actual_prev_id{};
std::vector<crypto::hash> actual_ids{};
GET_FROM_JSON_OBJECT(pub.second, actual_height, first_height);