fixed keys for pre+post Carrot mining rewards

This commit is contained in:
Some Random Crypto Guy
2025-07-04 16:03:57 +01:00
parent 52736ea0a3
commit aa02928620
5 changed files with 21 additions and 12 deletions
+9 -2
View File
@@ -58,8 +58,8 @@ CarrotDestinationV1 carrot_and_legacy_account::cryptonote_address(const payment_
switch (resolve_derive_type(derive_type)) switch (resolve_derive_type(derive_type))
{ {
case AddressDeriveType::Carrot: case AddressDeriveType::Carrot:
make_carrot_integrated_address_v1(get_keys().m_carrot_account_address.m_spend_public_key, make_carrot_integrated_address_v1(get_keys().m_carrot_main_address.m_spend_public_key,
get_keys().m_account_address.m_view_public_key, get_keys().m_carrot_main_address.m_view_public_key,
payment_id, payment_id,
addr); addr);
break; break;
@@ -326,6 +326,13 @@ void carrot_and_legacy_account::set_carrot_keys(const AddressDeriveType default_
m_keys.m_carrot_account_address.m_view_public_key m_keys.m_carrot_account_address.m_view_public_key
); );
// carrot main wallet address
m_keys.m_carrot_main_address.m_spend_public_key = m_keys.m_carrot_account_address.m_spend_public_key;
k_view_incoming_dev.view_key_scalar_mult_ed25519(
crypto::get_G(),
m_keys.m_carrot_main_address.m_view_public_key
);
this->default_derive_type = default_derive_type; this->default_derive_type = default_derive_type;
generate_subaddress_map(); generate_subaddress_map();
} }
+1 -1
View File
@@ -280,7 +280,7 @@ DISABLE_VS_WARNINGS(4244 4345)
std::string account_base::get_carrot_public_address_str(network_type nettype) const std::string account_base::get_carrot_public_address_str(network_type nettype) const
{ {
// Build the cryptonote::account_public_address // Build the cryptonote::account_public_address
account_public_address addr{m_keys.m_carrot_account_address.m_spend_public_key, m_keys.m_account_address.m_view_public_key}; account_public_address addr{m_keys.m_carrot_main_address.m_spend_public_key, m_keys.m_carrot_main_address.m_view_public_key};
// change this code into base 58 // change this code into base 58
return get_account_address_as_str(nettype, false, addr, true); return get_account_address_as_str(nettype, false, addr, true);
} }
+4 -1
View File
@@ -61,9 +61,12 @@ namespace cryptonote
crypto::secret_key k_generate_image; crypto::secret_key k_generate_image;
crypto::secret_key s_generate_address; crypto::secret_key s_generate_address;
// carrot public keys (minus K_v, which is shared with legacy K_v) // carrot public account address (K_s, K_v)
account_public_address m_carrot_account_address; account_public_address m_carrot_account_address;
// carrot main address (K^0_s, K^0_v)
account_public_address m_carrot_main_address;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(m_account_address) KV_SERIALIZE(m_account_address)
+2 -4
View File
@@ -767,7 +767,7 @@ void view_incoming_scan_transaction(
const bool is_carrot = carrot::is_carrot_transaction_v1(tx); const bool is_carrot = carrot::is_carrot_transaction_v1(tx);
perform_ecdh_derivations(epee::to_span(main_tx_ephemeral_pubkeys), perform_ecdh_derivations(epee::to_span(main_tx_ephemeral_pubkeys),
epee::to_span(additional_tx_ephemeral_pubkeys), epee::to_span(additional_tx_ephemeral_pubkeys),
account.get_keys().m_view_secret_key, is_carrot ? account.get_keys().k_view_incoming : account.get_keys().m_view_secret_key,
account.get_keys().get_device(), account.get_keys().get_device(),
is_carrot, is_carrot,
main_derivations, main_derivations,
@@ -864,9 +864,7 @@ std::optional<crypto::key_image> try_derive_enote_key_image(
{ {
const cryptonote::subaddress_index subaddr_index_cn{enote_scan_info.subaddr_index->index.major, const cryptonote::subaddress_index subaddr_index_cn{enote_scan_info.subaddr_index->index.major,
enote_scan_info.subaddr_index->index.minor}; enote_scan_info.subaddr_index->index.minor};
subaddress_extension = rct::sk2rct( subaddress_extension = rct::sk2rct(acc.get_keys().get_device().get_subaddress_secret_key(enote_scan_info.is_carrot ? acc.get_keys().k_view_incoming : acc.get_keys().m_view_secret_key, subaddr_index_cn));
acc.get_keys().get_device().get_subaddress_secret_key(acc.get_keys().m_view_secret_key, subaddr_index_cn)
);
} }
else // !subaddr_index_cn.is_zero() else // !subaddr_index_cn.is_zero()
{ {
+5 -4
View File
@@ -800,12 +800,13 @@ bool get_address_openings_x_y(
// 2. perform ECDH derivations // 2. perform ECDH derivations
std::vector<crypto::key_derivation> main_derivations; std::vector<crypto::key_derivation> main_derivations;
std::vector<crypto::key_derivation> additional_derivations; std::vector<crypto::key_derivation> additional_derivations;
bool is_carrot = carrot::is_carrot_transaction_v1(tx);
wallet::perform_ecdh_derivations( wallet::perform_ecdh_derivations(
main_tx_ephemeral_pubkeys, main_tx_ephemeral_pubkeys,
additional_tx_ephemeral_pubkeys, additional_tx_ephemeral_pubkeys,
w.get_account().get_keys().m_view_secret_key, is_carrot ? w.get_account().get_keys().k_view_incoming : w.get_account().get_keys().m_view_secret_key,
w.get_account().get_keys().get_device(), w.get_account().get_keys().get_device(),
carrot::is_carrot_transaction_v1(tx), is_carrot,
main_derivations, main_derivations,
additional_derivations additional_derivations
); );
@@ -948,8 +949,8 @@ cryptonote::transaction finalize_all_proofs_from_transfer_details(
//! @TODO: HW device //! @TODO: HW device
carrot::cryptonote_hierarchy_address_device_ram_borrowed addr_dev( carrot::cryptonote_hierarchy_address_device_ram_borrowed addr_dev(
acc_keys.m_account_address.m_spend_public_key, acc_keys.m_carrot_account_address.m_spend_public_key,
acc_keys.m_view_secret_key); acc_keys.k_view_incoming);
// finalize enotes // finalize enotes
LOG_PRINT_L3("Getting output enote proposals"); LOG_PRINT_L3("Getting output enote proposals");