Merge pull request #11142

c1df77c cryptonote_basic: remove dead code (Thomas)

ACKs: jpk68, UkoeHB
This commit is contained in:
tobtoht
2026-08-25 16:42:23 +00:00
9 changed files with 0 additions and 127 deletions
-3
View File
@@ -109,9 +109,6 @@ namespace cryptonote
uint64_t get_createtime() const { return m_creation_timestamp; }
void set_createtime(uint64_t val) { m_creation_timestamp = val; }
bool load(const std::string& file_path);
bool store(const std::string& file_path);
void forget_spend_key();
void set_spend_key(const crypto::secret_key& spend_secret_key);
const std::vector<crypto::secret_key> &get_multisig_keys() const { return m_keys.m_multisig_keys; }
@@ -33,7 +33,6 @@
#include "account.h"
#include "cryptonote_boost_serialization.h"
//namespace cryptonote {
namespace boost
{
namespace serialization
-71
View File
@@ -1,71 +0,0 @@
// Copyright (c) 2021-2024, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include "crypto/crypto.h"
#include "crypto/generators.h"
namespace cryptonote
{
enum class account_generator_era : unsigned char
{
unknown = 0,
cryptonote = 1 //and ringct
};
struct account_generators
{
crypto::public_key m_primary; //e.g. for spend key
crypto::public_key m_secondary; //e.g. for view key
};
inline crypto::public_key get_primary_generator(const account_generator_era era)
{
if (era == account_generator_era::cryptonote)
return crypto::get_G();
else
return crypto::null_pkey; //error
}
inline crypto::public_key get_secondary_generator(const account_generator_era era)
{
if (era == account_generator_era::cryptonote)
return crypto::get_G();
else
return crypto::null_pkey; //error
}
inline account_generators get_account_generators(const account_generator_era era)
{
return account_generators{get_primary_generator(era), get_secondary_generator(era)};
}
} //namespace cryptonote
-4
View File
@@ -52,9 +52,6 @@
namespace cryptonote
{
typedef std::vector<crypto::signature> ring_signature;
/* outputs */
struct txout_to_script
@@ -152,7 +149,6 @@ namespace cryptonote
typedef boost::variant<txout_to_script, txout_to_scripthash, txout_to_key, txout_to_tagged_key> txout_target_v;
//typedef std::pair<uint64_t, txout> out_t;
struct tx_out
{
uint64_t amount;
@@ -51,10 +51,6 @@ using namespace crypto;
static std::atomic<unsigned int> default_decimal_point(CRYPTONOTE_DISPLAY_DECIMAL_POINT);
static std::atomic<uint64_t> tx_hashes_calculated_count(0);
static std::atomic<uint64_t> tx_hashes_cached_count(0);
static std::atomic<uint64_t> block_hashes_calculated_count(0);
static std::atomic<uint64_t> block_hashes_cached_count(0);
#define CHECK_AND_ASSERT_THROW_MES_L1(expr, message) {if(!(expr)) {MWARNING(message); throw std::runtime_error(message);}}
@@ -955,14 +951,6 @@ namespace cryptonote
: boost::optional<crypto::view_tag>();
}
//---------------------------------------------------------------
std::string short_hash_str(const crypto::hash& h)
{
std::string res = string_tools::pod_to_hex(h);
CHECK_AND_ASSERT_MES(res.size() == 64, res, "wrong hash256 with string_tools::pod_to_hex conversion");
auto erased_pos = res.erase(8, 48);
res.insert(8, "....");
return res;
}
//---------------------------------------------------------------
void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, tx_out& out)
{
@@ -1327,11 +1315,9 @@ namespace cryptonote
CHECK_AND_ASSERT_THROW_MES(!calculate_transaction_prunable_hash(t, blobdata, res) || t.hash == res, "tx hash cash integrity failure");
#endif
res = t.prunable_hash;
++tx_hashes_cached_count;
return res;
}
++tx_hashes_calculated_count;
CHECK_AND_ASSERT_THROW_MES(calculate_transaction_prunable_hash(t, blobdata, res), "Failed to calculate tx prunable hash");
t.set_prunable_hash(res);
return res;
@@ -1441,10 +1427,8 @@ namespace cryptonote
}
*blob_size = t.blob_size;
}
++tx_hashes_cached_count;
return true;
}
++tx_hashes_calculated_count;
bool ret = calculate_transaction_hash(t, res, blob_size);
if (!ret)
return false;
@@ -1523,10 +1507,8 @@ namespace cryptonote
CHECK_AND_ASSERT_THROW_MES(!calculate_block_hash(b, res) || b.hash == res, "block hash cash integrity failure");
#endif
res = b.hash;
++block_hashes_cached_count;
return true;
}
++block_hashes_calculated_count;
bool ret = calculate_block_hash(b, res);
if (!ret)
return false;
@@ -1571,7 +1553,6 @@ namespace cryptonote
if (block_hash)
{
calculate_block_hash(b, *block_hash, &b_blob);
++block_hashes_calculated_count;
b.set_hash(*block_hash);
}
return true;
@@ -1695,14 +1676,6 @@ namespace cryptonote
return amount < 10; // are we left with 1 leading digit?
}
//---------------------------------------------------------------
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t & block_hashes_cached)
{
tx_hashes_calculated = tx_hashes_calculated_count;
tx_hashes_cached = tx_hashes_cached_count;
block_hashes_calculated = block_hashes_calculated_count;
block_hashes_cached = block_hashes_cached_count;
}
//---------------------------------------------------------------
crypto::secret_key encrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase)
{
crypto::hash hash;
@@ -110,7 +110,6 @@ namespace cryptonote
void get_blob_hash(const blobdata_ref& blob, crypto::hash& res);
crypto::hash get_blob_hash(const blobdata& blob);
crypto::hash get_blob_hash(const blobdata_ref& blob);
std::string short_hash_str(const crypto::hash& h);
crypto::hash get_transaction_hash(const transaction& t);
bool get_transaction_hash(const transaction& t, crypto::hash& res);
@@ -154,13 +153,6 @@ namespace cryptonote
uint64_t round_money_up(uint64_t amount, unsigned significant_digits);
std::string round_money_up(const std::string &amount, unsigned significant_digits);
//---------------------------------------------------------------
template<class t_object>
bool t_serializable_object_from_blob(t_object& to, const blobdata& b_blob)
{
binary_archive<false> ba{epee::strspan<std::uint8_t>(b_blob)};
bool r = ::serialization::serialize(ba, to);
return r;
}
//---------------------------------------------------------------
template<class t_object>
bool t_serializable_object_to_blob(const t_object& to, blobdata& b_blob)
@@ -267,7 +259,6 @@ namespace cryptonote
const uint8_t major_version,
const crypto::hash &seed_hash);
bool is_valid_decomposed_amount(uint64_t amount);
void get_hash_stats(uint64_t &tx_hashes_calculated, uint64_t &tx_hashes_cached, uint64_t &block_hashes_calculated, uint64_t & block_hashes_cached);
crypto::secret_key encrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase);
crypto::secret_key decrypt_key(crypto::secret_key key, const epee::wipeable_string &passphrase);
-1
View File
@@ -229,7 +229,6 @@ namespace cryptonote
/**
* @brief returns the size of the voting window in blocks
*/
uint64_t get_window_size() const { return window_size; }
/**
* @brief returns info for all known hard forks
-10
View File
@@ -60,16 +60,6 @@ uint32_t get_aux_slot(const crypto::hash &id, uint32_t nonce, uint32_t n_aux_cha
return SWAP32LE(v) % n_aux_chains;
}
//---------------------------------------------------------------
uint32_t get_path_from_aux_slot(uint32_t slot, uint32_t n_aux_chains)
{
CHECK_AND_ASSERT_THROW_MES(n_aux_chains > 0, "n_aux_chains is 0");
CHECK_AND_ASSERT_THROW_MES(slot < n_aux_chains, "slot >= n_aux_chains");
uint32_t path = 0;
CHECK_AND_ASSERT_THROW_MES(tree_path(n_aux_chains, slot, &path), "Failed to get path from aux slot");
return path;
}
//---------------------------------------------------------------
uint64_t encode_mm_depth(uint32_t n_aux_chains, uint32_t nonce)
{
CHECK_AND_ASSERT_THROW_MES(n_aux_chains > 0, "n_aux_chains is 0");
-1
View File
@@ -34,7 +34,6 @@
namespace cryptonote
{
uint32_t get_aux_slot(const crypto::hash &id, uint32_t nonce, uint32_t n_aux_chains);
uint32_t get_path_from_aux_slot(uint32_t slot, uint32_t n_aux_chains);
uint64_t encode_mm_depth(uint32_t n_aux_chains, uint32_t nonce);
bool decode_mm_depth(uint64_t depth, uint32_t &n_aux_chains, uint32_t &nonce);
}