generate & scan correct carrot pubkeys
This commit is contained in:
@@ -302,12 +302,12 @@ crypto::secret_key carrot_and_legacy_account::generate(
|
||||
crypto::secret_key retval = cryptonote::account_base::generate(recovery_key, recover, two_random);
|
||||
|
||||
// generate carrot keys
|
||||
set_carrot_keys();
|
||||
set_carrot_keys(default_derive_type);
|
||||
|
||||
return retval;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
void carrot_and_legacy_account::set_carrot_keys()
|
||||
void carrot_and_legacy_account::set_carrot_keys(const AddressDeriveType default_derive_type)
|
||||
{
|
||||
// top level keys
|
||||
m_keys.s_master = m_keys.m_spend_secret_key;
|
||||
@@ -315,7 +315,6 @@ void carrot_and_legacy_account::set_carrot_keys()
|
||||
make_carrot_viewbalance_secret(m_keys.s_master, m_keys.s_view_balance);
|
||||
|
||||
// view balance keys
|
||||
make_carrot_viewincoming_key(m_keys.s_view_balance, m_keys.k_view_incoming);
|
||||
make_carrot_generateimage_key(m_keys.s_view_balance, m_keys.k_generate_image);
|
||||
make_carrot_generateaddress_secret(m_keys.s_view_balance, m_keys.s_generate_address);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace carrot
|
||||
std::unordered_map<crypto::public_key, subaddress_index_extended> subaddress_map;
|
||||
AddressDeriveType default_derive_type;
|
||||
|
||||
carrot_and_legacy_account(): k_view_incoming_dev(get_keys().k_view_incoming),
|
||||
carrot_and_legacy_account(): k_view_incoming_dev(get_keys().m_view_secret_key),
|
||||
s_view_balance_dev(get_keys().s_view_balance),
|
||||
s_generate_address_dev(get_keys().s_generate_address)
|
||||
{}
|
||||
@@ -106,7 +106,7 @@ namespace carrot
|
||||
const AddressDeriveType default_derive_type = AddressDeriveType::Carrot
|
||||
);
|
||||
|
||||
void set_carrot_keys();
|
||||
void set_carrot_keys(const AddressDeriveType default_derive_type = AddressDeriveType::Carrot);
|
||||
|
||||
AddressDeriveType resolve_derive_type(const AddressDeriveType derive_type) const;
|
||||
};
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
#include "wallet/message_store.h"
|
||||
#include "QrCode.hpp"
|
||||
|
||||
#include "carrot_impl/subaddress_index.h"
|
||||
#include "carrot_core/core_types.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -5226,8 +5229,14 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
|
||||
recovery_val = m_wallet->generate(m_wallet_file, std::move(rc.second).password(), recovery_key, recover, two_random, create_address_file);
|
||||
message_writer(console_color_white, true) << tr("Generated new legacy wallet: ")
|
||||
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
|
||||
|
||||
const auto addr = m_wallet->get_account().cryptonote_address(carrot::null_payment_id, carrot::AddressDeriveType::Carrot);
|
||||
cryptonote::account_public_address carrot_address {
|
||||
.m_spend_public_key = addr.address_spend_pubkey,
|
||||
.m_view_public_key = addr.address_view_pubkey
|
||||
};
|
||||
message_writer(console_color_white, true) << tr("Generated new carrot wallet: ")
|
||||
<< cryptonote::get_account_address_as_str(m_wallet->nettype(), false, m_wallet->get_account().get_keys().m_carrot_account_address);
|
||||
<< cryptonote::get_account_address_as_str(m_wallet->nettype(), false, carrot_address);
|
||||
PAUSE_READLINE();
|
||||
std::cout << tr("View key: ");
|
||||
print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key);
|
||||
@@ -5469,9 +5478,14 @@ boost::optional<epee::wipeable_string> simple_wallet::open_wallet(const boost::p
|
||||
message_writer(console_color_white, true) <<
|
||||
prefix << ": " << m_wallet->get_account().get_public_address_str(m_wallet->nettype());
|
||||
|
||||
const auto addr = m_wallet->get_account().cryptonote_address(carrot::null_payment_id, carrot::AddressDeriveType::Carrot);
|
||||
cryptonote::account_public_address carrot_address {
|
||||
.m_spend_public_key = addr.address_spend_pubkey,
|
||||
.m_view_public_key = addr.address_view_pubkey
|
||||
};
|
||||
prefix = tr("Opened carrot wallet");
|
||||
message_writer(console_color_white, true) <<
|
||||
prefix << ": " << cryptonote::get_account_address_as_str(m_wallet->nettype(), false, m_wallet->get_account().get_keys().m_carrot_account_address);
|
||||
prefix << ": " << cryptonote::get_account_address_as_str(m_wallet->nettype(), false, carrot_address);
|
||||
if (m_wallet->get_account().get_device()) {
|
||||
message_writer(console_color_white, true) << "Wallet is on device: " << m_wallet->get_account().get_device().get_name();
|
||||
}
|
||||
|
||||
@@ -726,9 +726,7 @@ void view_incoming_scan_transaction(
|
||||
|
||||
//! @TODO: HW device
|
||||
const bool is_carrot = carrot::is_carrot_transaction_v1(tx);
|
||||
carrot::view_incoming_key_ram_borrowed_device k_view_dev(
|
||||
is_carrot ? acc.k_view_incoming : acc.m_view_secret_key
|
||||
);
|
||||
carrot::view_incoming_key_ram_borrowed_device k_view_dev(acc.m_view_secret_key);
|
||||
|
||||
// do view-incoming scan for each output enotes
|
||||
for (size_t local_output_index = 0; local_output_index < n_outputs; ++local_output_index)
|
||||
@@ -775,7 +773,7 @@ void view_incoming_scan_transaction(
|
||||
const bool is_carrot = carrot::is_carrot_transaction_v1(tx);
|
||||
perform_ecdh_derivations(epee::to_span(main_tx_ephemeral_pubkeys),
|
||||
epee::to_span(additional_tx_ephemeral_pubkeys),
|
||||
is_carrot ? acc.k_view_incoming : acc.m_view_secret_key,
|
||||
acc.m_view_secret_key,
|
||||
acc.get_device(),
|
||||
is_carrot,
|
||||
main_derivations,
|
||||
|
||||
Reference in New Issue
Block a user