diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp index 5572bf969..c7ad82eec 100644 --- a/src/cryptonote_basic/account.cpp +++ b/src/cryptonote_basic/account.cpp @@ -283,9 +283,9 @@ DISABLE_VS_WARNINGS(4244 4345) std::string account_base::get_carrot_public_address_str(network_type nettype) const { // Build the cryptonote::account_public_address - account_public_address addr{m_keys.m_carrot_main_address.m_spend_public_key, m_keys.m_carrot_main_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, true}; // 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); } //----------------------------------------------------------------- std::string account_base::get_public_integrated_address_str(const crypto::hash8 &payment_id, network_type nettype) const diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp index bfa041c07..611253152 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.cpp +++ b/src/cryptonote_basic/cryptonote_basic_impl.cpp @@ -155,10 +155,9 @@ namespace cryptonote { network_type nettype , bool subaddress , account_public_address const & adr - , bool is_carrot ) { - uint64_t address_prefix = is_carrot + uint64_t address_prefix = adr.m_is_carrot ? (subaddress ? get_config(nettype).CARROT_PUBLIC_SUBADDRESS_BASE58_PREFIX : get_config(nettype).CARROT_PUBLIC_ADDRESS_BASE58_PREFIX) : (subaddress ? get_config(nettype).CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX : get_config(nettype).CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX); @@ -169,10 +168,9 @@ namespace cryptonote { network_type nettype , account_public_address const & adr , crypto::hash8 const & payment_id - , bool is_carrot ) { - uint64_t integrated_address_prefix = is_carrot ? get_config(nettype).CARROT_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX : get_config(nettype).CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX; + uint64_t integrated_address_prefix = adr.m_is_carrot ? get_config(nettype).CARROT_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX : get_config(nettype).CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX; integrated_address iadr = { adr, payment_id diff --git a/src/cryptonote_basic/cryptonote_basic_impl.h b/src/cryptonote_basic/cryptonote_basic_impl.h index ea20aae9e..92c97f401 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.h +++ b/src/cryptonote_basic/cryptonote_basic_impl.h @@ -88,14 +88,12 @@ namespace cryptonote { network_type nettype , bool subaddress , const account_public_address& adr - , bool is_carrot = false ); std::string get_account_integrated_address_as_str( network_type nettype , const account_public_address& adr , const crypto::hash8& payment_id - , bool is_carrot = false ); bool get_account_address_from_str( diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 6c8eb0177..2338ac120 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -1355,7 +1355,7 @@ bool t_rpc_command_executor::print_transaction_pool_stats() { bool t_rpc_command_executor::start_mining(cryptonote::account_public_address address, uint64_t num_threads, cryptonote::network_type nettype, bool do_background_mining, bool ignore_battery, bool is_carrot) { cryptonote::COMMAND_RPC_START_MINING::request req; cryptonote::COMMAND_RPC_START_MINING::response res; - req.miner_address = cryptonote::get_account_address_as_str(nettype, false, address, is_carrot); + req.miner_address = cryptonote::get_account_address_as_str(nettype, false, address); req.threads_count = num_threads; req.do_background_mining = do_background_mining; req.ignore_battery = ignore_battery; diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 430f43fcd..40c21feac 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -5335,7 +5335,7 @@ boost::optional simple_wallet::new_wallet(const boost::pr .m_is_carrot = true }; message_writer(console_color_white, true) << tr("Generated new Carrot wallet: ") - << cryptonote::get_account_address_as_str(m_wallet->nettype(), false, carrot_address, true); + << 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); @@ -11231,9 +11231,9 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v success_msg_writer() << tr("Index: ") << i; std::string address; if (row.m_has_payment_id) - address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id, row.m_is_carrot); + address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id); else - address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address, row.m_is_carrot); + address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address); success_msg_writer() << tr("Address: ") << address; success_msg_writer() << tr("Description: ") << row.m_description << "\n"; } diff --git a/src/wallet/tx_builder.cpp b/src/wallet/tx_builder.cpp index f953d235b..873aa4a29 100644 --- a/src/wallet/tx_builder.cpp +++ b/src/wallet/tx_builder.cpp @@ -148,7 +148,7 @@ static cryptonote::tx_destination_entry make_tx_destination_entry( const carrot::CarrotPaymentProposalV1 &payment_proposal) { cryptonote::tx_destination_entry dest = cryptonote::tx_destination_entry(payment_proposal.amount, - {payment_proposal.destination.address_spend_pubkey, payment_proposal.destination.address_view_pubkey}, + {payment_proposal.destination.address_spend_pubkey, payment_proposal.destination.address_view_pubkey, /*m_is_carrot*/true}, payment_proposal.destination.is_subaddress); dest.is_integrated = payment_proposal.destination.payment_id != carrot::null_payment_id; return dest; @@ -166,8 +166,8 @@ static cryptonote::tx_destination_entry make_tx_destination_entry( "make_tx_destination_entry: view-key multiplication failed"); return cryptonote::tx_destination_entry(payment_proposal.proposal.amount, - {payment_proposal.proposal.destination_address_spend_pubkey, address_view_pubkey}, - payment_proposal.subaddr_index.index.is_subaddress()); + {payment_proposal.proposal.destination_address_spend_pubkey, address_view_pubkey, /*m_is_carrot*/true}, + payment_proposal.subaddr_index.index.is_subaddress()); } //------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------- diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 0ddd7c1f3..2e248fb68 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1606,7 +1606,7 @@ std::string wallet2::get_subaddress_as_str(const carrot::subaddress_index_extend addr.m_is_carrot = subaddr.derive_type == carrot::AddressDeriveType::Carrot; // change this code into base 58 - return cryptonote::get_account_address_as_str(m_nettype, address.is_subaddress, addr, addr.m_is_carrot); + return cryptonote::get_account_address_as_str(m_nettype, address.is_subaddress, addr); } //---------------------------------------------------------------------------------------------------- std::string wallet2::get_integrated_address_as_str(const crypto::hash8& payment_id, bool carrot) const @@ -1618,7 +1618,7 @@ std::string wallet2::get_integrated_address_as_str(const crypto::hash8& payment_ account_public_address addr{address.address_spend_pubkey, address.address_view_pubkey}; addr.m_is_carrot = carrot; - return cryptonote::get_account_integrated_address_as_str(m_nettype, addr, payment_id, carrot); + return cryptonote::get_account_integrated_address_as_str(m_nettype, addr, payment_id); } //---------------------------------------------------------------------------------------------------- void wallet2::add_subaddress_account(const std::string& label) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index d917207d9..042724abe 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -3305,9 +3305,9 @@ namespace tools const auto &entry = ab[idx]; std::string address; if (entry.m_has_payment_id) - address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id, entry.m_is_carrot); + address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id); else - address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address, entry.m_is_carrot); + address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address); res.entries.push_back(wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::entry{idx, address, entry.m_description}); } }