Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bfb5f51bf | |||
| d7a9facee9 | |||
| 260bc3721b | |||
| 3e0457de09 | |||
| ce6f6e0593 | |||
| f1efb700d2 | |||
| dd246296b9 | |||
| 22334d7c6c | |||
| c07698fcc8 | |||
| ce69272638 | |||
| 2b95d100b3 | |||
| b7706d4def |
Binary file not shown.
@@ -6514,7 +6514,7 @@ void Blockchain::cancel()
|
||||
}
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
static const char expected_block_hashes_hash[] = "a2a5a9bc5d606392ac5c14be55b90a92b8577b8ffdac5c63cc6174f41764c753";
|
||||
static const char expected_block_hashes_hash[] = "1cf6e8892e0512c246cef62610ccf524f30f484e307ae01959a5a7dd166aa328";
|
||||
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
||||
{
|
||||
if (get_checkpoints == nullptr || !m_fast_sync)
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace
|
||||
const char* USAGE_RPC_PAYMENT_INFO("rpc_payment_info");
|
||||
const char* USAGE_START_MINING_FOR_RPC("start_mining_for_rpc [<number_of_threads>]");
|
||||
const char* USAGE_STOP_MINING_FOR_RPC("stop_mining_for_rpc");
|
||||
const char* USAGE_SHOW_QR_CODE("show_qr_code [<subaddress_index>]");
|
||||
const char* USAGE_SHOW_QR_CODE("show_qr_code [<subaddress_index>] [<address_type>]");
|
||||
const char* USAGE_VERSION("version");
|
||||
const char* USAGE_HELP("help [<command> | all]");
|
||||
const char* USAGE_APROPOS("apropos <keyword> [<keyword> ...]");
|
||||
@@ -2559,6 +2559,7 @@ bool simple_wallet::stop_mining_for_rpc(const std::vector<std::string> &args)
|
||||
bool simple_wallet::show_qr_code(const std::vector<std::string> &args)
|
||||
{
|
||||
uint32_t subaddress_index = 0;
|
||||
carrot::AddressDeriveType derive_type;
|
||||
if (args.size() >= 1)
|
||||
{
|
||||
if (!string_tools::get_xtype_from_string(subaddress_index, args[0]))
|
||||
@@ -2572,6 +2573,25 @@ bool simple_wallet::show_qr_code(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args.size() >= 2)
|
||||
{
|
||||
// Convert string to AddressDeriveType enum
|
||||
if (args[1] == "carrot" || args[1] == "Carrot")
|
||||
{
|
||||
derive_type = carrot::AddressDeriveType::Carrot;
|
||||
}
|
||||
else if (args[1] == "precarrot" || args[1] == "PreCarrot")
|
||||
{
|
||||
derive_type = carrot::AddressDeriveType::PreCarrot;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail_msg_writer() << tr("invalid derive type: must be 'carrot' or 'precarrot'");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
derive_type = carrot::AddressDeriveType::Auto;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PRINT_UTF8(pre, x) std::wcout << pre ## x
|
||||
@@ -2586,7 +2606,8 @@ bool simple_wallet::show_qr_code(const std::vector<std::string> &args)
|
||||
WTEXTON();
|
||||
try
|
||||
{
|
||||
const std::string address = "salvium:" + m_wallet->get_subaddress_as_str({m_current_subaddress_account, subaddress_index});
|
||||
const std::string address = "salvium:" + m_wallet->get_subaddress_as_str({m_current_subaddress_account, subaddress_index, derive_type, false});
|
||||
message_writer() << "Showing QR code for address: " << address.c_str() << std::endl;
|
||||
const qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(address.c_str(), qrcodegen::QrCode::Ecc::LOW);
|
||||
for (int y = -2; y < qr.getSize() + 2; y+=2)
|
||||
{
|
||||
@@ -6472,7 +6493,7 @@ bool simple_wallet::show_balance_unlocked(bool detailed)
|
||||
if (!detailed || balance_per_subaddress.empty())
|
||||
continue;
|
||||
success_msg_writer() << tr("Balance per address:");
|
||||
success_msg_writer() << boost::format("%15s %21s %21s %7s %21s") % tr("Address") % tr("Balance") % tr("Unlocked balance") % tr("Outputs") % tr("Label");
|
||||
success_msg_writer() << boost::format("%16s %21s %21s %7s %21s") % tr("Address") % tr("Balance") % tr("Unlocked balance") % tr("Outputs") % tr("Label");
|
||||
std::vector<tools::wallet2::transfer_details> transfers;
|
||||
m_wallet->get_transfers(transfers);
|
||||
for (const auto& i : balance_per_subaddress)
|
||||
@@ -6480,9 +6501,9 @@ bool simple_wallet::show_balance_unlocked(bool detailed)
|
||||
carrot::subaddress_index_extended subaddr = {{m_current_subaddress_account, i.first},
|
||||
is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot};
|
||||
cryptonote::subaddress_index subaddr_index = {m_current_subaddress_account, i.first};
|
||||
std::string address_str = m_wallet->get_subaddress_as_str(subaddr).substr(0, 6);
|
||||
std::string address_str = m_wallet->get_subaddress_as_str(subaddr).substr(0, 8);
|
||||
uint64_t num_unspent_outputs = std::count_if(transfers.begin(), transfers.end(), [&subaddr_index](const tools::wallet2::transfer_details& td) { return !td.m_spent && td.m_subaddr_index == subaddr_index; });
|
||||
success_msg_writer() << boost::format(tr("%8u %6s %21s %21s %7u %21s")) % i.first % address_str % print_money(i.second) % print_money(unlocked_balance_per_subaddress[i.first].first) % num_unspent_outputs % m_wallet->get_subaddress_label(subaddr_index);
|
||||
success_msg_writer() << boost::format(tr("%8u %8s %21s %21s %7u %21s")) % i.first % address_str % print_money(i.second) % print_money(unlocked_balance_per_subaddress[i.first].first) % num_unspent_outputs % m_wallet->get_subaddress_label(subaddr_index);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -9902,7 +9923,7 @@ bool simple_wallet::get_transfers(std::vector<std::string>& local_args, std::vec
|
||||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
std::string note = m_wallet->get_tx_note(pd.m_tx_hash);
|
||||
std::string destination = m_wallet->get_subaddress_as_str({m_current_subaddress_account, pd.m_subaddr_index.minor});
|
||||
std::string destination = m_wallet->get_subaddress_as_str({{m_current_subaddress_account, pd.m_subaddr_index.minor}, pd.m_is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
const std::string type =
|
||||
pd.m_tx_type == cryptonote::transaction_type::STAKE ? "stake" :
|
||||
pd.m_coinbase ? tr("block") : tr("in");
|
||||
@@ -10105,7 +10126,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
{
|
||||
if (!destinations.empty())
|
||||
destinations += ", ";
|
||||
destinations += (transfer.direction == "in" ? output.first.substr(0, 6) : output.first) + ":" + print_money(output.second);
|
||||
destinations += ((transfer.direction == "in" || transfer.direction == "block") ? output.first.substr(0, 8) : output.first) + ":" + print_money(output.second);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10631,7 +10652,7 @@ std::string simple_wallet::get_prompt() const
|
||||
{
|
||||
if (m_locked)
|
||||
return std::string("[") + tr("locked due to inactivity") + "]";
|
||||
std::string addr_start = m_wallet->get_subaddress_as_str({m_current_subaddress_account, 0}).substr(0, 6);
|
||||
std::string addr_start = m_wallet->get_subaddress_as_str({m_current_subaddress_account, 0}).substr(0, 8);
|
||||
std::string prompt = std::string("[") + tr("wallet") + " " + addr_start;
|
||||
if (!m_wallet->check_connection(NULL))
|
||||
prompt += tr(" (no daemon)");
|
||||
@@ -10854,7 +10875,7 @@ void simple_wallet::print_accounts(const std::string& tag)
|
||||
success_msg_writer() << tr("Accounts with tag: ") << tag;
|
||||
success_msg_writer() << tr("Tag's description: ") << account_tags.first.find(tag)->second;
|
||||
}
|
||||
success_msg_writer() << boost::format(" %15s %21s %21s %21s %21s") % tr("Account") % tr("Balance") % tr("Unlocked balance") % tr("Asset") % tr("Label");
|
||||
success_msg_writer() << boost::format(" %18s %21s %21s %6s %21s") % tr("Account") % tr("Balance") % tr("Unlocked balance") % tr("Asset") % tr("Label");
|
||||
std::map<std::string, std::pair<uint64_t, uint64_t>> total_balances;
|
||||
std::vector<std::string> asset_types_in_wallet = m_wallet->list_asset_types();
|
||||
for (const auto& asset: asset_types_in_wallet) {
|
||||
@@ -10868,10 +10889,10 @@ void simple_wallet::print_accounts(const std::string& tag)
|
||||
auto unlocked_balance = m_wallet->unlocked_balance(account_index, asset, false);
|
||||
if (balance == 0)
|
||||
continue;
|
||||
success_msg_writer() << boost::format(tr(" %c%8u %6s %21s %21s %21s %21s"))
|
||||
success_msg_writer() << boost::format(tr(" %c%8u %8s %21s %21s %6s %21s"))
|
||||
% (m_current_subaddress_account == account_index ? '*' : ' ')
|
||||
% account_index
|
||||
% m_wallet->get_subaddress_as_str({account_index, 0}).substr(0, 6)
|
||||
% m_wallet->get_subaddress_as_str({{account_index, 0}, carrot::AddressDeriveType::Auto}).substr(0, 8)
|
||||
% print_money(balance)
|
||||
% print_money(unlocked_balance)
|
||||
% asset
|
||||
@@ -10882,9 +10903,9 @@ void simple_wallet::print_accounts(const std::string& tag)
|
||||
if (total_balance > 0)
|
||||
total_balances[asset] = std::pair<uint64_t, uint64_t>(total_balance, total_unlocked_balance);
|
||||
}
|
||||
success_msg_writer() << tr("------------------------------------------------------------------------------------");
|
||||
success_msg_writer() << tr("------------------------------------------------------------------------------------------------------");
|
||||
for (const auto& it: total_balances)
|
||||
success_msg_writer() << boost::format(tr("%15s %21s %21s %15s")) % "Total" % print_money(it.second.first) % print_money(it.second.second) % it.first;
|
||||
success_msg_writer() << boost::format(tr("%18s %21s %21s %6s")) % "Total" % print_money(it.second.first) % print_money(it.second.second) % it.first;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::print_address(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||
@@ -10900,16 +10921,35 @@ bool simple_wallet::print_address(const std::vector<std::string> &args/* = std::
|
||||
std::vector<std::string> local_args = args;
|
||||
tools::wallet2::transfer_container transfers;
|
||||
m_wallet->get_transfers(transfers);
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
auto print_address_sub = [this, &transfers, is_carrot](uint32_t index)
|
||||
auto print_address_sub = [this, &transfers](uint32_t index, bool cryptonote = true, bool carrot = true)
|
||||
{
|
||||
bool used = std::find_if(
|
||||
transfers.begin(), transfers.end(),
|
||||
[this, &index](const tools::wallet2::transfer_details& td) {
|
||||
return td.m_subaddr_index == cryptonote::subaddress_index{ m_current_subaddress_account, index };
|
||||
}) != transfers.end();
|
||||
success_msg_writer() << index << " " << m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot}) << " " << (index == 0 ? tr("Primary address") : m_wallet->get_subaddress_label({m_current_subaddress_account, index})) << " " << (used ? tr("(used)") : "");
|
||||
if (!cryptonote) {
|
||||
success_msg_writer() << boost::format(tr("%8u %96s %21s %6s"))
|
||||
% index
|
||||
% m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, carrot::AddressDeriveType::Carrot})
|
||||
% (index == 0 ? tr("Primary address") : m_wallet->get_subaddress_label({m_current_subaddress_account, index}))
|
||||
% (used ? tr("(used)") : "");
|
||||
} else if (!carrot) {
|
||||
success_msg_writer() << boost::format(tr("%8u %96s %21s %6s"))
|
||||
% index
|
||||
% m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, carrot::AddressDeriveType::PreCarrot})
|
||||
% (index == 0 ? tr("Primary address") : m_wallet->get_subaddress_label({m_current_subaddress_account, index}))
|
||||
% (used ? tr("(used)") : "");
|
||||
} else {
|
||||
success_msg_writer() << boost::format(tr("%8u CN %96s %21s %6s\n Carrot %96s\n"))
|
||||
% index
|
||||
% m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, carrot::AddressDeriveType::PreCarrot})
|
||||
% (index == 0 ? tr("Primary address") : m_wallet->get_subaddress_label({m_current_subaddress_account, index}))
|
||||
% (used ? tr("(used)") : "")
|
||||
% m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, carrot::AddressDeriveType::Carrot});
|
||||
}
|
||||
//success_msg_writer() << index << " " << m_wallet->get_subaddress_as_str({{m_current_subaddress_account, index}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot}) << " " << (index == 0 ? tr("Primary address") : m_wallet->get_subaddress_label({m_current_subaddress_account, index})) << " " << (used ? tr("(used)") : "");
|
||||
};
|
||||
|
||||
uint32_t index = 0;
|
||||
@@ -10917,11 +10957,22 @@ bool simple_wallet::print_address(const std::vector<std::string> &args/* = std::
|
||||
{
|
||||
print_address_sub(index);
|
||||
}
|
||||
else if (local_args.size() == 1 && local_args[0] == "all")
|
||||
else if (local_args[0] == "all")
|
||||
{
|
||||
local_args.erase(local_args.begin());
|
||||
for (; index < m_wallet->get_num_subaddresses(m_current_subaddress_account); ++index)
|
||||
print_address_sub(index);
|
||||
if (local_args.size() == 0) {
|
||||
message_writer(console_color_green, true) << tr(" INDEX TYPE ADDRESS");
|
||||
for (; index < m_wallet->get_num_subaddresses(m_current_subaddress_account); ++index)
|
||||
print_address_sub(index);
|
||||
} else if (local_args[0] == "cn") {
|
||||
message_writer(console_color_green, true) << tr(" INDEX ADDRESS");
|
||||
for (; index < m_wallet->get_num_subaddresses(m_current_subaddress_account); ++index)
|
||||
print_address_sub(index, true, false);
|
||||
} else {
|
||||
message_writer(console_color_green, true) << tr(" INDEX ADDRESS");
|
||||
for (; index < m_wallet->get_num_subaddresses(m_current_subaddress_account); ++index)
|
||||
print_address_sub(index, false, true);
|
||||
}
|
||||
}
|
||||
else if (local_args[0] == "new")
|
||||
{
|
||||
@@ -11321,7 +11372,9 @@ bool simple_wallet::wallet_info(const std::vector<std::string> &args)
|
||||
}
|
||||
message_writer() << tr("Filename: ") << m_wallet->get_wallet_file();
|
||||
message_writer() << tr("Description: ") << description;
|
||||
message_writer() << tr("Address: ") << m_wallet->get_account().get_public_address_str(m_wallet->nettype());
|
||||
message_writer() << tr("CN Address: ") << m_wallet->get_account().get_public_address_str(m_wallet->nettype());
|
||||
message_writer() << tr("Carrot Address: ") << m_wallet->get_account().get_carrot_public_address_str(m_wallet->nettype());
|
||||
|
||||
std::string type;
|
||||
if (m_wallet->watch_only())
|
||||
type = tr("Watch only");
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
|
||||
#define DEF_SALVIUM_VERSION "1.0.0"
|
||||
#define DEF_SALVIUM_VERSION "1.0.1"
|
||||
#define DEF_MONERO_VERSION_TAG "release"
|
||||
#define DEF_MONERO_VERSION "0.18.3.4"
|
||||
#define DEF_MONERO_RELEASE_NAME "One"
|
||||
|
||||
+41
-2
@@ -1584,11 +1584,24 @@ crypto::public_key wallet2::get_subaddress_spend_public_key(const cryptonote::su
|
||||
return hwdev.get_subaddress_spend_public_key(m_account.get_keys(), index);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::string wallet2::get_subaddress_as_str(const carrot::subaddress_index_extended& subaddr) const
|
||||
std::string wallet2::get_subaddress_as_str(const carrot::subaddress_index_extended& subaddr_const) const
|
||||
{
|
||||
carrot::CarrotDestinationV1 address = m_account.subaddress(subaddr);
|
||||
// Make a non-const copy of subaddr
|
||||
carrot::subaddress_index_extended subaddr(subaddr_const);
|
||||
|
||||
// Handle "auto" - the account class doesn't know the HF version, so this is the cleanest solution
|
||||
if (subaddr.derive_type == carrot::AddressDeriveType::Auto) {
|
||||
|
||||
// Get the HF version
|
||||
uint32_t hf_version = estimate_current_hard_fork();
|
||||
THROW_WALLET_EXCEPTION_IF(hf_version == 0, error::wallet_internal_error, "unable to estimate the current hard fork - cannot generate subaddress as string");
|
||||
|
||||
// Change the non-const derivation type
|
||||
subaddr.derive_type = (hf_version >= HF_VERSION_CARROT) ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot;
|
||||
}
|
||||
|
||||
// Build the cryptonote::account_public_address
|
||||
carrot::CarrotDestinationV1 address = m_account.subaddress(subaddr);
|
||||
account_public_address addr{address.address_spend_pubkey, address.address_view_pubkey};
|
||||
addr.m_is_carrot = subaddr.derive_type == carrot::AddressDeriveType::Carrot;
|
||||
|
||||
@@ -2936,6 +2949,7 @@ void wallet2::process_new_scanned_transaction(
|
||||
payment.m_coinbase = miner_tx;
|
||||
payment.m_subaddr_index = i.first;
|
||||
payment.m_tx_type = tx.type;
|
||||
payment.m_is_carrot = (tx.version >= TRANSACTION_VERSION_CARROT);
|
||||
if (pool) {
|
||||
if (emplace_or_replace(m_unconfirmed_payments, payment_id, pool_payment_details{payment, double_spend_seen}))
|
||||
all_same = false;
|
||||
@@ -12312,6 +12326,31 @@ void wallet2::device_show_address(uint32_t account_index, uint32_t address_index
|
||||
hwdev.display_address(subaddress_index{account_index, address_index}, payment_id);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint8_t wallet2::estimate_current_hard_fork(const uint64_t height) const
|
||||
{
|
||||
// Get the last-seen top height by the wallet
|
||||
uint64_t guessed_height = (height > 0) ? height : m_blockchain.size();
|
||||
|
||||
// Get the correct hardfork table, based on current net type
|
||||
const hardfork_t *hfs =
|
||||
(m_nettype == cryptonote::MAINNET) ? mainnet_hard_forks :
|
||||
(m_nettype == cryptonote::TESTNET) ? testnet_hard_forks :
|
||||
stagenet_hard_forks;
|
||||
size_t hfs_count =
|
||||
(m_nettype == cryptonote::MAINNET) ? num_mainnet_hard_forks :
|
||||
(m_nettype == cryptonote::TESTNET) ? num_testnet_hard_forks :
|
||||
num_stagenet_hard_forks;
|
||||
|
||||
// Iterate over the hard fork table, to see what the current fork is for the guessed height
|
||||
for (size_t i = hfs_count-1; i>=0; --i) {
|
||||
if (hfs[i].height <= guessed_height)
|
||||
return hfs[i].version;
|
||||
}
|
||||
|
||||
// return "no value found" to the caller
|
||||
return 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint8_t wallet2::get_current_hard_fork()
|
||||
{
|
||||
if (m_offline)
|
||||
|
||||
+16
-2
@@ -496,9 +496,10 @@ private:
|
||||
bool m_coinbase;
|
||||
cryptonote::subaddress_index m_subaddr_index;
|
||||
cryptonote::transaction_type m_tx_type;
|
||||
bool m_is_carrot;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
VERSION_FIELD(0)
|
||||
VERSION_FIELD(1)
|
||||
FIELD(m_tx_hash)
|
||||
VARINT_FIELD(m_amount)
|
||||
FIELD(m_asset_type)
|
||||
@@ -510,6 +511,11 @@ private:
|
||||
FIELD(m_coinbase)
|
||||
FIELD(m_subaddr_index)
|
||||
VARINT_FIELD(m_tx_type)
|
||||
if (version < 1) {
|
||||
m_is_carrot = false;
|
||||
return true;
|
||||
}
|
||||
FIELD(m_is_carrot)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
@@ -1197,6 +1203,7 @@ private:
|
||||
std::vector<crypto::public_key> get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const;
|
||||
//std::string get_subaddress_as_str(const cryptonote::subaddress_index& index) const;
|
||||
std::string get_subaddress_as_str(const carrot::subaddress_index_extended& index) const;
|
||||
std::string get_subaddress_as_str(const carrot::subaddress_index_extended& index, const uint64_t height) const;
|
||||
std::string get_address_as_str() const { return get_subaddress_as_str({0, 0}); }
|
||||
std::string get_integrated_address_as_str(const crypto::hash8& payment_id, bool carrot = true) const;
|
||||
void add_subaddress_account(const std::string& label);
|
||||
@@ -1661,6 +1668,7 @@ private:
|
||||
size_t get_num_transfer_details() const { return m_transfers.size(); }
|
||||
const transfer_details &get_transfer_details(size_t idx) const;
|
||||
|
||||
uint8_t estimate_current_hard_fork(const uint64_t height = 0) const;
|
||||
uint8_t get_current_hard_fork();
|
||||
void get_hard_fork_info(uint8_t version, uint64_t &earliest_height);
|
||||
bool use_fork_rules(uint8_t version, int64_t early_blocks = 0);
|
||||
@@ -2293,7 +2301,7 @@ BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 5)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 6)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 6)
|
||||
@@ -2622,6 +2630,12 @@ namespace boost
|
||||
a & x.m_amounts;
|
||||
a & x.m_asset_type;
|
||||
a & x.m_tx_type;
|
||||
if (ver < 6)
|
||||
{
|
||||
x.m_is_carrot = false;
|
||||
return;
|
||||
}
|
||||
a & x.m_is_carrot;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace tools
|
||||
entry.subaddr_index = pd.m_subaddr_index;
|
||||
entry.subaddr_indices.push_back(pd.m_subaddr_index);
|
||||
//entry.address = m_wallet->get_subaddress_as_str(pd.m_subaddr_index);
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(entry.height) >= HF_VERSION_CARROT;
|
||||
entry.address = m_wallet->get_subaddress_as_str({{pd.m_subaddr_index.major, pd.m_subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
|
||||
}
|
||||
@@ -473,7 +473,7 @@ namespace tools
|
||||
for (uint32_t i: pd.m_subaddr_indices)
|
||||
entry.subaddr_indices.push_back({pd.m_subaddr_account, i});
|
||||
//entry.address = m_wallet->get_subaddress_as_str({pd.m_subaddr_account, 0});
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(entry.height) >= HF_VERSION_CARROT;
|
||||
entry.address = m_wallet->get_subaddress_as_str({{pd.m_subaddr_account, 0}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
|
||||
}
|
||||
@@ -508,7 +508,7 @@ namespace tools
|
||||
for (uint32_t i: pd.m_subaddr_indices)
|
||||
entry.subaddr_indices.push_back({pd.m_subaddr_account, i});
|
||||
//entry.address = m_wallet->get_subaddress_as_str({pd.m_subaddr_account, 0});
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(entry.height) >= HF_VERSION_CARROT;
|
||||
entry.address = m_wallet->get_subaddress_as_str({{pd.m_subaddr_account, 0}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_tx.unlock_time);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ namespace tools
|
||||
entry.subaddr_index = pd.m_subaddr_index;
|
||||
entry.subaddr_indices.push_back(pd.m_subaddr_index);
|
||||
//entry.address = m_wallet->get_subaddress_as_str(pd.m_subaddr_index);
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(entry.height) >= HF_VERSION_CARROT;
|
||||
entry.address = m_wallet->get_subaddress_as_str({{pd.m_subaddr_index.major, pd.m_subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
|
||||
}
|
||||
@@ -542,8 +542,8 @@ namespace tools
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
std::vector<std::string> assets_in_wallet = m_wallet->list_asset_types();
|
||||
std::string asset_type = req.asset_type.empty() ? "SAL1" : boost::algorithm::to_upper_copy(req.asset_type);
|
||||
// verify that the asset is in the list of in-wallet assets
|
||||
@@ -627,8 +627,6 @@ namespace tools
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
try
|
||||
{
|
||||
THROW_WALLET_EXCEPTION_IF(req.account_index >= m_wallet->get_num_subaddress_accounts(), error::account_index_outofbound);
|
||||
@@ -651,14 +649,14 @@ namespace tools
|
||||
res.addresses.resize(res.addresses.size() + 1);
|
||||
auto& info = res.addresses.back();
|
||||
const cryptonote::subaddress_index index = {req.account_index, i};
|
||||
//info.address = m_wallet->get_subaddress_as_str(index);
|
||||
info.address = m_wallet->get_subaddress_as_str({{req.account_index, i}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
info.address = m_wallet->get_subaddress_as_str({req.account_index, i});
|
||||
info.address_cn = req.cryptonote ? m_wallet->get_subaddress_as_str({{req.account_index, i}, carrot::AddressDeriveType::PreCarrot}) : "";
|
||||
info.address_carrot = req.carrot ? m_wallet->get_subaddress_as_str({{req.account_index, i}, carrot::AddressDeriveType::Carrot}) : "";
|
||||
info.label = m_wallet->get_subaddress_label(index);
|
||||
info.address_index = index.minor;
|
||||
info.used = std::find_if(transfers.begin(), transfers.end(), [&](const tools::wallet2::transfer_details& td) { return td.m_subaddr_index == index; }) != transfers.end();
|
||||
}
|
||||
//res.address = m_wallet->get_subaddress_as_str({req.account_index, 0});
|
||||
res.address = m_wallet->get_subaddress_as_str({{req.account_index, 0}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
res.address = m_wallet->get_subaddress_as_str({req.account_index, 0});
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@@ -701,8 +699,6 @@ namespace tools
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
std::vector<std::string> addresses;
|
||||
std::vector<uint32_t> address_indices;
|
||||
|
||||
@@ -713,8 +709,7 @@ namespace tools
|
||||
m_wallet->add_subaddress(req.account_index, req.label);
|
||||
uint32_t new_address_index = m_wallet->get_num_subaddresses(req.account_index) - 1;
|
||||
address_indices.push_back(new_address_index);
|
||||
//addresses.push_back(m_wallet->get_subaddress_as_str({req.account_index, new_address_index}));
|
||||
addresses.push_back(m_wallet->get_subaddress_as_str({{req.account_index, new_address_index}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot}));
|
||||
addresses.push_back(m_wallet->get_subaddress_as_str({req.account_index, new_address_index}));
|
||||
}
|
||||
|
||||
res.address = addresses[0];
|
||||
@@ -750,8 +745,6 @@ namespace tools
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
try
|
||||
{
|
||||
res.total_balance = 0;
|
||||
@@ -772,8 +765,7 @@ namespace tools
|
||||
continue;
|
||||
wallet_rpc::COMMAND_RPC_GET_ACCOUNTS::subaddress_account_info info;
|
||||
info.account_index = subaddr_index.major;
|
||||
//info.base_address = m_wallet->get_subaddress_as_str(subaddr_index);
|
||||
info.base_address = m_wallet->get_subaddress_as_str({{subaddr_index.major, subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
info.base_address = m_wallet->get_subaddress_as_str({{subaddr_index.major, 0}, carrot::AddressDeriveType::Auto});
|
||||
|
||||
//for (const auto& asset: asset_types) {
|
||||
info.balance = m_wallet->balance(subaddr_index.major, "SAL1", req.strict_balances);
|
||||
@@ -810,9 +802,7 @@ namespace tools
|
||||
{
|
||||
m_wallet->add_subaddress_account(req.label);
|
||||
res.account_index = m_wallet->get_num_subaddress_accounts() - 1;
|
||||
//res.address = m_wallet->get_subaddress_as_str({res.account_index, 0});
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
res.address = m_wallet->get_subaddress_as_str({{res.account_index, 0}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
res.address = m_wallet->get_subaddress_as_str({res.account_index, 0});
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@@ -2109,8 +2099,6 @@ namespace tools
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
crypto::hash payment_id;
|
||||
crypto::hash8 payment_id8;
|
||||
cryptonote::blobdata payment_id_blob;
|
||||
@@ -2151,7 +2139,7 @@ namespace tools
|
||||
rpc_payment.unlock_time = payment.m_unlock_time;
|
||||
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.m_unlock_time, payment.m_block_height);
|
||||
rpc_payment.subaddr_index = payment.m_subaddr_index;
|
||||
//rpc_payment.address = m_wallet->get_subaddress_as_str(payment.m_subaddr_index);
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(payment.m_block_height) >= HF_VERSION_CARROT;
|
||||
rpc_payment.address = m_wallet->get_subaddress_as_str({{payment.m_subaddr_index.major, payment.m_subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
res.payments.push_back(rpc_payment);
|
||||
}
|
||||
@@ -2163,8 +2151,6 @@ namespace tools
|
||||
{
|
||||
res.payments.clear();
|
||||
|
||||
bool is_carrot = m_wallet->get_current_hard_fork() >= HF_VERSION_CARROT;
|
||||
|
||||
if (!m_wallet) return not_open(er);
|
||||
|
||||
/* If the payment ID list is empty, we get payments to any payment ID (or lack thereof) */
|
||||
@@ -2182,7 +2168,7 @@ namespace tools
|
||||
rpc_payment.block_height = payment.second.m_block_height;
|
||||
rpc_payment.unlock_time = payment.second.m_unlock_time;
|
||||
rpc_payment.subaddr_index = payment.second.m_subaddr_index;
|
||||
//rpc_payment.address = m_wallet->get_subaddress_as_str(payment.second.m_subaddr_index);
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(payment.second.m_block_height) >= HF_VERSION_CARROT;
|
||||
rpc_payment.address = m_wallet->get_subaddress_as_str({{payment.second.m_subaddr_index.major, payment.second.m_subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.second.m_unlock_time, payment.second.m_block_height);
|
||||
res.payments.push_back(std::move(rpc_payment));
|
||||
@@ -2238,7 +2224,7 @@ namespace tools
|
||||
rpc_payment.block_height = payment.m_block_height;
|
||||
rpc_payment.unlock_time = payment.m_unlock_time;
|
||||
rpc_payment.subaddr_index = payment.m_subaddr_index;
|
||||
//rpc_payment.address = m_wallet->get_subaddress_as_str(payment.m_subaddr_index);
|
||||
bool is_carrot = m_wallet->estimate_current_hard_fork(payment.m_block_height) >= HF_VERSION_CARROT;
|
||||
rpc_payment.address = m_wallet->get_subaddress_as_str({{payment.m_subaddr_index.major, payment.m_subaddr_index.minor}, is_carrot ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot});
|
||||
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.m_unlock_time, payment.m_block_height);
|
||||
res.payments.push_back(std::move(rpc_payment));
|
||||
|
||||
@@ -139,9 +139,13 @@ namespace wallet_rpc
|
||||
{
|
||||
uint32_t account_index;
|
||||
std::vector<uint32_t> address_index;
|
||||
bool carrot;
|
||||
bool cryptonote;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(account_index)
|
||||
KV_SERIALIZE(address_index)
|
||||
KV_SERIALIZE_OPT(carrot, true);
|
||||
KV_SERIALIZE_OPT(cryptonote, true);
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
@@ -149,12 +153,16 @@ namespace wallet_rpc
|
||||
struct address_info
|
||||
{
|
||||
std::string address;
|
||||
std::string address_cn;
|
||||
std::string address_carrot;
|
||||
std::string label;
|
||||
uint32_t address_index;
|
||||
bool used;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(address)
|
||||
KV_SERIALIZE(address_cn)
|
||||
KV_SERIALIZE(address_carrot)
|
||||
KV_SERIALIZE(label)
|
||||
KV_SERIALIZE(address_index)
|
||||
KV_SERIALIZE(used)
|
||||
|
||||
Reference in New Issue
Block a user