fixed building issues; added carrot key initialisation to wallet2

This commit is contained in:
Some Random Crypto Guy
2025-06-09 11:18:51 +01:00
parent adcb66d268
commit d53a0669c9
6 changed files with 18 additions and 6 deletions

View File

@@ -294,9 +294,10 @@ void carrot_and_legacy_account::generate_subaddress_map()
//----------------------------------------------------------------------------------------------------------------------
void carrot_and_legacy_account::generate(const AddressDeriveType default_derive_type)
{
legacy_acb.generate();
//legacy_acb.generate();
crypto::generate_random_bytes_thread_safe(sizeof(crypto::secret_key), to_bytes(s_master));
//crypto::generate_random_bytes_thread_safe(sizeof(crypto::secret_key), to_bytes(s_master));
s_master = legacy_acb.get_keys().m_spend_secret_key;
make_carrot_provespend_key(s_master, k_prove_spend);
make_carrot_viewbalance_secret(s_master, s_view_balance);
make_carrot_generateimage_key(s_view_balance, k_generate_image);

View File

@@ -92,8 +92,8 @@ namespace rct {
zk_proof PRProof_Gen(const rct::key &difference);
bool PRProof_Ver(const rct::key &C, const zk_proof &proof);
zk_proof SAProof_Gen(const key &P, const key &x_change, const key &y_change, const key &key_yF);
bool SAProof_Ver(const zk_proof &proof, const key &P, const key &key_yF);
zk_proof SAProof_Gen(const key &P, const key &x_change, const key &y_change);
bool SAProof_Ver(const zk_proof &proof, const key &P);
//proveRange and verRange
//proveRange gives C, and mask such that \sumCi = C

View File

@@ -38,7 +38,6 @@ set(wallet_sources
message_store.cpp
message_transporter.cpp
wallet_rpc_payments.cpp
scanning_tools.cpp
tx_builder.cpp
)

View File

@@ -639,7 +639,8 @@ std::vector<cryptonote::tx_source_entry> get_sources(
const size_t fake_outputs_count = 15;
std::vector<std::vector<tools::wallet2::get_outs_entry>> outs;
std::unordered_set<crypto::public_key> valid_public_keys_cache;
w.get_outs(outs, selected_transfers, fake_outputs_count, true, valid_public_keys_cache); // may throw
wallet2 &w2 = const_cast<tools::wallet2 &>(w);
w2.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;

View File

@@ -2323,6 +2323,7 @@ bool wallet2::get_yield_summary_info(uint64_t &total_burnt,
// Return success to caller
return true;
}
/*
//----------------------------------------------------------------------------------------------------
bool wallet2::verify_spend_authority_proof(const cryptonote::transaction &tx, const size_t i, const tx_scan_info_t &tx_scan_info)
{
@@ -2394,6 +2395,7 @@ bool wallet2::verify_spend_authority_proof(const cryptonote::transaction &tx, co
// Return success to caller
return true;
}
*/
//----------------------------------------------------------------------------------------------------
void wallet2::scan_key_image(const wallet::enote_view_incoming_scan_info_t &enote_scan_info,
const bool pool,
@@ -5300,6 +5302,13 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
r = r && hwdev.verify_keys(keys.m_spend_secret_key, keys.m_account_address.m_spend_public_key);
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_files_doesnt_correspond, m_keys_file, m_wallet_file);
if (r)
{
// Generate the Carrot keys here
m_carrot_account.legacy_acb = m_account;
m_carrot_account.generate();
}
if (r)
{
if (!m_is_background_wallet)

View File

@@ -2032,8 +2032,10 @@ private:
void set_unspent(size_t idx);
bool is_spent(const transfer_details &td, bool strict = true) const;
bool is_spent(size_t idx, bool strict = true) const;
public:
void get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count, bool rct, std::unordered_set<crypto::public_key> &valid_public_keys_cache);
void get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count, std::vector<uint64_t> &rct_offsets, std::unordered_set<crypto::public_key> &valid_public_keys_cache, uint64_t &num_spendable_global_outs, uint64_t &num_outs);
private:
bool tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& tx_public_key, const rct::key& mask, uint64_t real_index, bool unlocked, std::unordered_set<crypto::public_key> &valid_public_keys_cache) const;
bool should_pick_a_second_output(bool use_rct, size_t n_transfers, const std::vector<size_t> &unused_transfers_indices, const std::vector<size_t> &unused_dust_indices) const;
std::vector<size_t> get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const;