Skip to content

Instantly share code, notes, and snippets.

@stoffu
Created July 4, 2022 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoffu/a3a409318b72c8787e3fda0c1fb68cf1 to your computer and use it in GitHub Desktop.
Save stoffu/a3a409318b72c8787e3fda0c1fb68cf1 to your computer and use it in GitHub Desktop.
wallet2: remove most includes
--- wallet2.cpp 2022-06-17 22:26:39.000000000 +0900
+++ wallet2.new.cpp 2022-07-05 01:24:17.000000000 +0900
@@ -44,6 +44,7 @@
#include "cryptonote_config.h"
#include "wallet2.h"
+#if 0
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "rpc/core_rpc_server_commands_defs.h"
#include "misc_language.h"
@@ -81,6 +82,7 @@
using namespace std;
using namespace crypto;
using namespace cryptonote;
+#endif
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"
@@ -131,15 +133,20 @@
{
std::string get_default_ringdb_path()
{
+ return {};
+#if 0
boost::filesystem::path dir = tools::get_default_data_dir();
// remove .aeon, replace with .aeon-shared-ringdb
dir = dir.remove_filename();
dir /= ".aeon-shared-ringdb";
return dir.string();
+#endif
}
std::string pack_multisignature_keys(const std::string& prefix, const std::vector<crypto::public_key>& keys, const crypto::secret_key& signer_secret_key)
{
+ return {};
+#if 0
std::string data;
crypto::public_key signer;
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(signer_secret_key, signer), "Failed to derive public spend key");
@@ -158,11 +165,13 @@
crypto::generate_signature(hash, signer, signer_secret_key, signature);
return MULTISIG_EXTRA_INFO_MAGIC + tools::base58::encode(data);
+#endif
}
std::vector<crypto::public_key> secret_keys_to_public_keys(const std::vector<crypto::secret_key>& keys)
{
std::vector<crypto::public_key> public_keys;
+#if 0
public_keys.reserve(keys.size());
std::transform(keys.begin(), keys.end(), std::back_inserter(public_keys), [] (const crypto::secret_key& k) -> crypto::public_key {
@@ -170,12 +179,14 @@
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(k, p), "Failed to derive public spend key");
return p;
});
+#endif
return public_keys;
}
bool keys_intersect(const std::unordered_set<crypto::public_key>& s1, const std::unordered_set<crypto::public_key>& s2)
{
+#if 0
if (s1.empty() || s2.empty())
return false;
@@ -185,6 +196,7 @@
return true;
}
+#endif
return false;
}
}
@@ -203,6 +215,7 @@
const command_line::arg_descriptor<std::string> daemon_login = {"daemon-login", tools::wallet2::tr("Specify username[:password] for daemon RPC client"), "", true};
const command_line::arg_descriptor<bool> testnet = {"testnet", tools::wallet2::tr("For testnet. Daemon must also be launched with --testnet flag"), false};
const command_line::arg_descriptor<bool> stagenet = {"stagenet", tools::wallet2::tr("For stagenet. Daemon must also be launched with --stagenet flag"), false};
+#if 0
const command_line::arg_descriptor<std::string, false, true, 2> shared_ringdb_dir = {
"shared-ringdb-dir", tools::wallet2::tr("Set shared ring database path"),
get_default_ringdb_path(),
@@ -215,12 +228,14 @@
return val;
}
};
+#endif
const command_line::arg_descriptor<uint64_t> kdf_rounds = {"kdf-rounds", tools::wallet2::tr("Number of rounds for the key derivation function"), 1};
const command_line::arg_descriptor<std::string> tx_notify = { "tx-notify" , "Run a program for each new incoming transaction, '%s' will be replaced by the transaction hash" , "" };
};
void do_prepare_file_names(const std::string& file_path, std::string& keys_file, std::string& wallet_file)
{
+#if 0
keys_file = file_path;
wallet_file = file_path;
boost::system::error_code e;
@@ -231,11 +246,14 @@
{//provided wallet file name
keys_file += ".keys";
}
+#endif
}
} // namespace
uint64_t tools::wallet2::calculate_fee(uint64_t fee_per_kb, size_t bytes, uint64_t fee_multiplier)
{
+ return {};
+#if 0
uint64_t kB = (bytes + 1023) / 1024;
uint64_t fee = kB * fee_per_kb;
if (!use_fork_rules(2))
@@ -243,26 +261,38 @@
fee = std::max<uint64_t>(DEFAULT_FEE_V1, fee);
}
return fee * fee_multiplier;
+#endif
}
uint64_t tools::wallet2::calculate_fee(uint64_t fee_per_kb, const cryptonote::blobdata &blob, uint64_t fee_multiplier)
{
+ return {};
+#if 0
return calculate_fee(fee_per_kb, blob.size(), fee_multiplier);
+#endif
}
namespace {
std::string get_weight_string(size_t weight)
{
+ return {};
+#if 0
return std::to_string(weight) + " weight";
+#endif
}
std::string get_weight_string(const cryptonote::transaction &tx, size_t blob_size)
{
+ return {};
+#if 0
return get_weight_string(get_transaction_weight(tx, blob_size));
+#endif
}
std::unique_ptr<tools::wallet2> make_basic(const boost::program_options::variables_map& vm, bool unattended, const options& opts, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const bool testnet = command_line::get_arg(vm, opts.testnet);
const bool stagenet = command_line::get_arg(vm, opts.stagenet);
const network_type nettype = testnet ? TESTNET : stagenet ? STAGENET : MAINNET;
@@ -340,10 +370,13 @@
wallet->device_name(device_name);
return wallet;
+#endif
}
boost::optional<tools::password_container> get_password(const boost::program_options::variables_map& vm, const options& opts, const std::function<boost::optional<tools::password_container>(const char*, bool)> &password_prompter, const bool verify)
{
+ return {};
+#if 0
if (command_line::has_arg(vm, opts.password) && command_line::has_arg(vm, opts.password_file))
{
THROW_WALLET_EXCEPTION(tools::error::wallet_internal_error, tools::wallet2::tr("can't specify more than one of --password and --password-file"));
@@ -369,10 +402,13 @@
THROW_WALLET_EXCEPTION_IF(!password_prompter, tools::error::wallet_internal_error, tools::wallet2::tr("no password specified; use --prompt-for-password to prompt for a password"));
return password_prompter(verify ? tools::wallet2::tr("Enter a new password for the wallet") : tools::wallet2::tr("Wallet password"), verify);
+#endif
}
std::pair<std::unique_ptr<tools::wallet2>, tools::password_container> generate_from_json(const std::string& json_file, const boost::program_options::variables_map& vm, bool unattended, const options& opts, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const bool testnet = command_line::get_arg(vm, opts.testnet);
const bool stagenet = command_line::get_arg(vm, opts.stagenet);
const network_type nettype = testnet ? TESTNET : stagenet ? STAGENET : MAINNET;
@@ -575,10 +611,12 @@
return {std::move(wallet), tools::password_container(password)};
}
return {nullptr, tools::password_container{}};
+#endif
}
static void throw_on_rpc_response_error(const boost::optional<std::string> &status, const char *method)
{
+#if 0
// no error
if (!status)
return;
@@ -588,10 +626,13 @@
THROW_WALLET_EXCEPTION_IF(*status == CORE_RPC_STATUS_BUSY, tools::error::daemon_busy, method);
THROW_WALLET_EXCEPTION_IF(*status != CORE_RPC_STATUS_OK, tools::error::wallet_generic_rpc_error, method, *status);
+#endif
}
std::string strjoin(const std::vector<size_t> &V, const char *sep)
{
+ return {};
+#if 0
std::stringstream ss;
bool first = true;
for (const auto &v: V)
@@ -602,11 +643,14 @@
first = false;
}
return ss.str();
+#endif
}
static bool emplace_or_replace(std::unordered_multimap<crypto::hash, tools::wallet2::pool_payment_details> &container,
const crypto::hash &key, const tools::wallet2::pool_payment_details &pd)
{
+ return {};
+#if 0
auto range = container.equal_range(key);
for (auto i = range.first; i != range.second; ++i)
{
@@ -618,10 +662,12 @@
}
container.emplace(key, pd);
return true;
+#endif
}
void drop_from_short_history(std::list<crypto::hash> &short_chain_history, size_t N)
{
+#if 0
std::list<crypto::hash>::iterator right;
// drop early N off, skipping the genesis block
if (short_chain_history.size() > N) {
@@ -631,10 +677,13 @@
std::advance(left, -N);
short_chain_history.erase(left, right);
}
+#endif
}
size_t estimate_rct_tx_size(int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
{
+ return {};
+#if 0
size_t size = 0;
// tx prefix
@@ -684,20 +733,26 @@
LOG_PRINT_L2("estimated " << (bulletproof ? "bulletproof" : "borromean") << " rct tx size for " << n_inputs << " inputs with ring size " << (mixin+1) << " and " << n_outputs << " outputs: " << size << " (" << ((32 * n_inputs/*+1*/) + 2 * 32 * (mixin+1) * n_inputs + 32 * n_outputs) << " saved)");
return size;
+#endif
}
size_t estimate_tx_size(bool use_v1_borromean, bool use_rct, int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
{
+ return {};
+#if 0
if (use_rct)
return estimate_rct_tx_size(n_inputs, mixin, n_outputs, extra_size, bulletproof);
else if (use_v1_borromean)
return n_inputs * (mixin+1) * (APPROXIMATE_INPUT_BYTES - sizeof(crypto::ec_scalar)) + sizeof(crypto::ec_scalar) + extra_size;
else
return n_inputs * (mixin+1) * APPROXIMATE_INPUT_BYTES + extra_size;
+#endif
}
uint64_t estimate_tx_weight(bool use_v1_borromean, bool use_rct, int n_inputs, int mixin, int n_outputs, size_t extra_size, bool bulletproof)
{
+ return {};
+#if 0
size_t size = estimate_tx_size(use_v1_borromean, use_rct, n_inputs, mixin, n_outputs, extra_size, bulletproof);
if (use_rct && bulletproof && n_outputs > 2)
{
@@ -712,16 +767,22 @@
size += bp_clawback;
}
return size;
+#endif
}
uint8_t get_bulletproof_fork()
{
+ return {};
+#if 0
// in Aeon, RingCT is activated with bulletproof
return HF_VERSION_ALLOW_RCT;
+#endif
}
crypto::hash8 get_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
{
+ return {};
+#if 0
crypto::hash8 payment_id8 = null_hash8;
std::vector<tx_extra_field> tx_extra_fields;
parse_tx_extra(ptx.tx.extra, tx_extra_fields); // ok if partially parsed
@@ -739,10 +800,13 @@
}
}
return payment_id8;
+#endif
}
tools::wallet2::tx_construction_data get_construction_data_with_decrypted_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
{
+ return {};
+#if 0
tools::wallet2::tx_construction_data construction_data = ptx.construction_data;
crypto::hash8 payment_id = get_short_payment_id(ptx,hwdev);
if (payment_id != null_hash8)
@@ -757,14 +821,18 @@
LOG_PRINT_L1("Decrypted payment ID: " << payment_id);
}
return construction_data;
+#endif
}
uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra)
{
+ return {};
+#if 0
static constexpr uint32_t uint32_max = std::numeric_limits<uint32_t>::max();
if (idx > uint32_max - extra)
return uint32_max;
return idx + extra;
+#endif
}
//-----------------------------------------------------------------
@@ -782,6 +850,7 @@
w(w),
locked(password != boost::none)
{
+#if 0
if (!locked || w.is_unattended() || w.ask_password() != tools::wallet2::AskPasswordToDecrypt)
{
locked = false;
@@ -790,23 +859,28 @@
const epee::wipeable_string pass = password->password();
w.generate_chacha_key_from_password(pass, key);
w.decrypt_keys(key);
+#endif
}
wallet_keys_unlocker::wallet_keys_unlocker(wallet2 &w, bool locked, const epee::wipeable_string &password):
w(w),
locked(locked)
{
+#if 0
if (!locked)
return;
w.generate_chacha_key_from_password(password, key);
w.decrypt_keys(key);
+#endif
}
wallet_keys_unlocker::~wallet_keys_unlocker()
{
+#if 0
if (!locked)
return;
w.encrypt_keys(key);
+#endif
}
wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
@@ -874,21 +948,31 @@
bool wallet2::has_testnet_option(const boost::program_options::variables_map& vm)
{
+ return {};
+#if 0
return command_line::get_arg(vm, options().testnet);
+#endif
}
bool wallet2::has_stagenet_option(const boost::program_options::variables_map& vm)
{
+ return {};
+#if 0
return command_line::get_arg(vm, options().stagenet);
+#endif
}
std::string wallet2::device_name_option(const boost::program_options::variables_map& vm)
{
+ return {};
+#if 0
return "";
+#endif
}
void wallet2::init_options(boost::program_options::options_description& desc_params)
{
+#if 0
const options opts{};
command_line::add_arg(desc_params, opts.daemon_address);
command_line::add_arg(desc_params, opts.daemon_host);
@@ -903,17 +987,23 @@
command_line::add_arg(desc_params, opts.shared_ringdb_dir);
command_line::add_arg(desc_params, opts.kdf_rounds);
command_line::add_arg(desc_params, opts.tx_notify);
+#endif
}
std::pair<std::unique_ptr<wallet2>, tools::password_container> wallet2::make_from_json(const boost::program_options::variables_map& vm, bool unattended, const std::string& json_file, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const options opts{};
return generate_from_json(json_file, vm, unattended, opts, password_prompter);
+#endif
}
std::pair<std::unique_ptr<wallet2>, password_container> wallet2::make_from_file(
const boost::program_options::variables_map& vm, bool unattended, const std::string& wallet_file, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const options opts{};
auto pwd = get_password(vm, opts, password_prompter, false);
if (!pwd)
@@ -926,10 +1016,13 @@
wallet->load(wallet_file, pwd->password());
}
return {std::move(wallet), std::move(*pwd)};
+#endif
}
std::pair<std::unique_ptr<wallet2>, password_container> wallet2::make_new(const boost::program_options::variables_map& vm, bool unattended, const std::function<boost::optional<password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const options opts{};
auto pwd = get_password(vm, opts, password_prompter, true);
if (!pwd)
@@ -937,17 +1030,23 @@
return {nullptr, password_container{}};
}
return {make_basic(vm, unattended, opts, password_prompter), std::move(*pwd)};
+#endif
}
std::unique_ptr<wallet2> wallet2::make_dummy(const boost::program_options::variables_map& vm, bool unattended, const std::function<boost::optional<tools::password_container>(const char *, bool)> &password_prompter)
{
+ return {};
+#if 0
const options opts{};
return make_basic(vm, unattended, opts, password_prompter);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, bool ssl, bool trusted_daemon)
{
+ return {};
+#if 0
if(m_http_client.is_connected())
m_http_client.disconnect();
m_daemon_address = std::move(daemon_address);
@@ -955,26 +1054,35 @@
m_trusted_daemon = trusted_daemon;
MINFO("setting daemon to " << get_daemon_address());
return m_http_client.set_server(get_daemon_address(), get_daemon_login(), ssl);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, uint64_t upper_transaction_weight_limit, bool ssl, bool trusted_daemon)
{
+ return {};
+#if 0
m_checkpoints.init_default_checkpoints(m_nettype);
m_is_initialized = true;
m_upper_transaction_weight_limit = upper_transaction_weight_limit;
return set_daemon(daemon_address, daemon_login, ssl, trusted_daemon);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::is_deterministic() const
{
+ return {};
+#if 0
crypto::secret_key second;
keccak((uint8_t *)&get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
sc_reduce32((uint8_t *)&second);
return memcmp(second.data,get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key)) == 0;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase) const
{
+ return {};
+#if 0
bool keys_deterministic = is_deterministic();
if (!keys_deterministic)
{
@@ -997,10 +1105,13 @@
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase, bool raw) const
{
+ return {};
+#if 0
bool ready;
uint32_t threshold, total;
if (!multisig(&ready, &threshold, &total))
@@ -1060,10 +1171,13 @@
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::reconnect_device()
{
+ return {};
+#if 0
bool r = true;
hw::device &hwdev = hw::get_device(m_device_name);
hwdev.set_name(m_device_name);
@@ -1081,6 +1195,7 @@
m_account.set_device(hwdev);
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
/*!
@@ -1088,7 +1203,10 @@
*/
const std::string &wallet2::get_seed_language() const
{
+ return {};
+#if 0
return seed_language;
+#endif
}
/*!
* \brief Sets the seed language
@@ -1096,57 +1214,79 @@
*/
void wallet2::set_seed_language(const std::string &language)
{
+#if 0
seed_language = language;
+#endif
}
//----------------------------------------------------------------------------------------------------
cryptonote::account_public_address wallet2::get_subaddress(const cryptonote::subaddress_index& index) const
{
+ return {};
+#if 0
hw::device &hwdev = m_account.get_device();
return hwdev.get_subaddress(m_account.get_keys(), index);
+#endif
}
//----------------------------------------------------------------------------------------------------
boost::optional<cryptonote::subaddress_index> wallet2::get_subaddress_index(const cryptonote::account_public_address& address) const
{
+ return {};
+#if 0
auto index = m_subaddresses.find(address.m_spend_public_key);
if (index == m_subaddresses.end())
return boost::none;
return index->second;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const
{
+ return {};
+#if 0
hw::device &hwdev = m_account.get_device();
return hwdev.get_subaddress_spend_public_key(m_account.get_keys(), index);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::get_subaddress_as_str(const cryptonote::subaddress_index& index) const
{
+ return {};
+#if 0
cryptonote::account_public_address address = get_subaddress(index);
return cryptonote::get_account_address_as_str(m_nettype, !index.is_zero(), address);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::get_integrated_address_as_str(const crypto::hash8& payment_id) const
{
+ return {};
+#if 0
return cryptonote::get_account_integrated_address_as_str(m_nettype, get_address(), payment_id);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::add_subaddress_account(const std::string& label)
{
+#if 0
uint32_t index_major = (uint32_t)get_num_subaddress_accounts();
expand_subaddresses({index_major, 0});
m_subaddress_labels[index_major][0] = label;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::add_subaddress(uint32_t index_major, const std::string& label)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(index_major >= m_subaddress_labels.size(), error::account_index_outofbound);
uint32_t index_minor = (uint32_t)get_num_subaddresses(index_major);
expand_subaddresses({index_major, index_minor});
m_subaddress_labels[index_major][index_minor] = label;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::expand_subaddresses(const cryptonote::subaddress_index& index)
{
+#if 0
hw::device &hwdev = m_account.get_device();
if (m_subaddress_labels.size() <= index.major)
{
@@ -1181,31 +1321,39 @@
}
m_subaddress_labels[index.major].resize(index.minor + 1);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::get_subaddress_label(const cryptonote::subaddress_index& index) const
{
+ return {};
+#if 0
if (index.major >= m_subaddress_labels.size() || index.minor >= m_subaddress_labels[index.major].size())
{
MERROR("Subaddress label doesn't exist");
return "";
}
return m_subaddress_labels[index.major][index.minor];
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_subaddress_label(const cryptonote::subaddress_index& index, const std::string &label)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(index.major >= m_subaddress_labels.size(), error::account_index_outofbound);
THROW_WALLET_EXCEPTION_IF(index.minor >= m_subaddress_labels[index.major].size(), error::address_index_outofbound);
m_subaddress_labels[index.major][index.minor] = label;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_subaddress_lookahead(size_t major, size_t minor)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(major > 0xffffffff, error::wallet_internal_error, "Subaddress major lookahead is too large");
THROW_WALLET_EXCEPTION_IF(minor > 0xffffffff, error::wallet_internal_error, "Subaddress minor lookahead is too large");
m_subaddress_lookahead_major = major;
m_subaddress_lookahead_minor = minor;
+#endif
}
//----------------------------------------------------------------------------------------------------
/*!
@@ -1213,27 +1361,35 @@
*/
bool wallet2::is_deprecated() const
{
+ return {};
+#if 0
return is_old_file_format;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_spent(size_t idx, uint64_t height)
{
+#if 0
transfer_details &td = m_transfers[idx];
LOG_PRINT_L2("Setting SPENT at " << height << ": ki " << td.m_key_image << ", amount " << print_money(td.m_amount));
td.m_spent = true;
td.m_spent_height = height;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_unspent(size_t idx)
{
+#if 0
transfer_details &td = m_transfers[idx];
LOG_PRINT_L2("Setting UNSPENT: ki " << td.m_key_image << ", amount " << print_money(td.m_amount));
td.m_spent = false;
td.m_spent_height = 0;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::check_acc_out_precomp(const tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, tx_scan_info_t &tx_scan_info) const
{
+#if 0
hw::device &hwdev = m_account.get_device();
boost::unique_lock<hw::device> hwdev_lock (hwdev);
hwdev.set_mode(hw::device::TRANSACTION_PARSE);
@@ -1253,10 +1409,12 @@
tx_scan_info.money_transfered = 0;
}
tx_scan_info.error = false;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::check_acc_out_precomp(const tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info) const
{
+#if 0
if (!is_out_data || i >= is_out_data->received.size())
return check_acc_out_precomp(o, derivation, additional_derivations, i, tx_scan_info);
@@ -1270,20 +1428,25 @@
tx_scan_info.money_transfered = 0;
}
tx_scan_info.error = false;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::check_acc_out_precomp_once(const tx_out &o, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, size_t i, const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info, bool &already_seen) const
{
+#if 0
tx_scan_info.received = boost::none;
if (already_seen)
return;
check_acc_out_precomp(o, derivation, additional_derivations, i, tx_scan_info);
if (tx_scan_info.received)
already_seen = true;
+#endif
}
//----------------------------------------------------------------------------------------------------
static uint64_t decodeRct(const rct::rctSig & rv, const crypto::key_derivation &derivation, unsigned int i, rct::key & mask, hw::device &hwdev)
{
+ return {};
+#if 0
crypto::secret_key scalar1;
hwdev.derivation_to_scalar(derivation, i, scalar1);
try
@@ -1305,10 +1468,12 @@
LOG_ERROR("Failed to decode input " << i);
return 0;
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, const crypto::public_key &tx_pub_key, size_t i, tx_scan_info_t &tx_scan_info, int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_money_got_in_outs, std::vector<size_t> &outs)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(i >= tx.vout.size(), error::wallet_internal_error, "Invalid vout index");
// if keys are encrypted, ask for password
@@ -1351,10 +1516,12 @@
tx_money_got_in_outs[tx_scan_info.received->index] += tx_scan_info.money_transfered;
tx_scan_info.amount = tx_scan_info.money_transfered;
++num_vouts_received;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::cache_tx_data(const cryptonote::transaction& tx, const crypto::hash &txid, tx_cache_data &tx_cache_data) const
{
+#if 0
const cryptonote::account_keys& keys = m_account.get_keys();
if(!parse_tx_extra(tx.extra, tx_cache_data.tx_extra_fields))
@@ -1390,10 +1557,12 @@
}
}
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data)
{
+#if 0
// In this function, tx (probably) only contains the base information
// (that is, the prunable stuff may or may not be included)
if (!miner_tx && !pool)
@@ -1880,10 +2049,12 @@
if (tx_notify)
tx_notify->notify("%s", epee::string_tools::pod_to_hex(txid).c_str(), NULL);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_unconfirmed(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height)
{
+#if 0
if (m_unconfirmed_txs.empty())
return;
@@ -1900,10 +2071,12 @@
}
m_unconfirmed_txs.erase(unconf_it);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_outgoing(const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices)
{
+#if 0
std::pair<std::unordered_map<crypto::hash, confirmed_transfer_details>::iterator, bool> entry = m_confirmed_txs.insert(std::make_pair(txid, confirmed_transfer_details()));
// fill with the info we know, some info might already be there
if (entry.second)
@@ -1942,10 +2115,12 @@
entry.first->second.m_unlock_time = tx.unlock_time;
add_rings(tx);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const parsed_block &parsed_block, const crypto::hash& bl_id, uint64_t height, const std::vector<tx_cache_data> &tx_cache_data, size_t tx_cache_data_offset)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(bche.txs.size() + 1 != parsed_block.o_indices.indices.size(), error::wallet_internal_error,
"block transactions=" + std::to_string(bche.txs.size()) +
" not match with daemon response size=" + std::to_string(parsed_block.o_indices.indices.size()));
@@ -1980,10 +2155,12 @@
if (0 != m_callback)
m_callback->on_new_block(height, b);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity) const
{
+#if 0
size_t i = 0;
size_t current_multiplier = 1;
size_t blockchain_size = std::max((size_t)(m_blockchain.size() / granularity * granularity), m_blockchain.offset());
@@ -2013,17 +2190,21 @@
ids.push_back(m_blockchain[m_blockchain.offset()]);
if(m_blockchain.offset())
ids.push_back(m_blockchain.genesis());
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::parse_block_round(const cryptonote::blobdata &blob, cryptonote::block &bl, crypto::hash &bl_id, bool &error) const
{
+#if 0
error = !cryptonote::parse_and_validate_block_from_blob(blob, bl);
if (!error)
bl_id = get_block_hash(bl);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::pull_blocks(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t &current_height)
{
+#if 0
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
req.block_ids = short_chain_history;
@@ -2050,10 +2231,12 @@
MDEBUG("Pulled blocks: blocks_start_height " << blocks_start_height << ", count " << blocks.size()
<< ", height " << blocks_start_height + blocks.size() << ", node height " << res.current_height);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::pull_hashes(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes)
{
+#if 0
cryptonote::COMMAND_RPC_GET_HASHES_FAST::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_HASHES_FAST::response res = AUTO_VAL_INIT(res);
req.block_ids = short_chain_history;
@@ -2068,10 +2251,12 @@
blocks_start_height = res.start_height;
hashes = std::move(res.m_block_ids);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<parsed_block> &parsed_blocks, uint64_t& blocks_added)
{
+#if 0
size_t current_index = start_height;
blocks_added = 0;
@@ -2198,22 +2383,28 @@
++current_index;
tx_cache_data_offset += 1 + parsed_blocks[i].txes.size();
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::refresh(bool trusted_daemon)
{
+#if 0
uint64_t blocks_fetched = 0;
refresh(trusted_daemon, 0, blocks_fetched);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched)
{
+#if 0
bool received_money = false;
refresh(trusted_daemon, start_height, blocks_fetched, received_money);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error)
{
+#if 0
error = false;
last = false;
@@ -2278,10 +2469,12 @@
{
error = true;
}
+#endif
}
void wallet2::remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes)
{
+#if 0
// remove pool txes to us that aren't in the pool anymore
std::unordered_multimap<crypto::hash, wallet2::pool_payment_details>::iterator uit = m_unconfirmed_payments.begin();
while (uit != m_unconfirmed_payments.end())
@@ -2305,11 +2498,13 @@
m_callback->on_pool_tx_removed(txid);
}
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::update_pool_state(std::vector<std::pair<cryptonote::transaction, bool>> &process_txs, bool refreshed)
{
+#if 0
MDEBUG("update_pool_state start");
auto keys_reencryptor = epee::misc_utils::create_scope_leave_handler([&, this]() {
@@ -2522,10 +2717,12 @@
}
}
MDEBUG("update_pool_state end");
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_pool_state(const std::vector<std::pair<cryptonote::transaction, bool>> &txs)
{
+#if 0
const time_t now = time(NULL);
for (const auto &e: txs)
{
@@ -2540,10 +2737,12 @@
m_scanned_pool_txs[0].clear();
}
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force)
{
+#if 0
std::vector<crypto::hash> hashes;
const uint64_t checkpoint_height = m_checkpoints.get_max_height();
@@ -2604,11 +2803,14 @@
return;
}
}
+#endif
}
bool wallet2::add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash &payment_id, const std::string &description, bool is_subaddress)
{
+ return {};
+#if 0
wallet2::address_book_row a;
a.m_address = address;
a.m_payment_id = payment_id;
@@ -2620,20 +2822,25 @@
if(m_address_book.size() == old_size+1)
return true;
return false;
+#endif
}
bool wallet2::delete_address_book_row(std::size_t row_id) {
+ return {};
+#if 0
if(m_address_book.size() <= row_id)
return false;
m_address_book.erase(m_address_book.begin()+row_id);
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched, bool& received_money)
{
+#if 0
if(m_light_wallet) {
// MyMonero get_address_info needs to be called occasionally to trigger wallet sync.
@@ -2827,10 +3034,13 @@
m_first_refresh_done = true;
LOG_PRINT_L1("Refresh done, blocks received: " << blocks_fetched << ", balance (all accounts): " << print_money(balance_all()) << ", unlocked: " << print_money(unlocked_balance_all()));
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::refresh(bool trusted_daemon, uint64_t & blocks_fetched, bool& received_money, bool& ok)
{
+ return {};
+#if 0
try
{
refresh(trusted_daemon, 0, blocks_fetched, received_money);
@@ -2841,10 +3051,13 @@
ok = false;
}
return ok;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::get_rct_distribution(uint64_t &start_height, std::vector<uint64_t> &distribution)
{
+ return {};
+#if 0
uint32_t rpc_version;
boost::optional<std::string> result = m_node_rpc_proxy.get_rpc_version(rpc_version);
// no error
@@ -2909,10 +3122,12 @@
start_height = res.distributions[0].start_height;
distribution = std::move(res.distributions[0].distribution);
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::detach_blockchain(uint64_t height)
{
+#if 0
LOG_PRINT_L0("Detaching blockchain on height " << height);
// size 1 2 3 4 5 6 7 8 9
@@ -2973,17 +3188,23 @@
}
LOG_PRINT_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::deinit()
{
+ return {};
+#if 0
m_is_initialized=false;
unlock_keys_file();
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::clear()
{
+ return {};
+#if 0
m_blockchain.clear();
m_transfers.clear();
m_key_images.clear();
@@ -3001,6 +3222,7 @@
m_subaddress_labels.clear();
m_multisig_rounds_passed = 0;
return true;
+#endif
}
/*!
@@ -3012,6 +3234,8 @@
*/
bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable_string& password, bool watch_only)
{
+ return {};
+#if 0
std::string account_data;
std::string multisig_signers;
std::string multisig_derivations;
@@ -3189,10 +3413,12 @@
lock_keys_file();
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::setup_keys(const epee::wipeable_string &password)
{
+#if 0
crypto::chacha_key key;
crypto::generate_chacha_key(password.data(), password.size(), key, m_kdf_rounds);
@@ -3209,15 +3435,18 @@
cache_key_data[HASH_SIZE] = CACHE_KEY_TAIL;
cn_fast_hash(cache_key_data.data(), HASH_SIZE+1, (crypto::hash&)m_cache_key);
get_ringdb_key();
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::change_password(const std::string &filename, const epee::wipeable_string &original_password, const epee::wipeable_string &new_password)
{
+#if 0
if (m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only)
decrypt_keys(original_password);
setup_keys(new_password);
rewrite(filename, new_password);
store();
+#endif
}
//----------------------------------------------------------------------------------------------------
/*!
@@ -3227,6 +3456,8 @@
*/
bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_string& password)
{
+ return {};
+#if 0
rapidjson::Document json;
wallet2::keys_file_data keys_file_data;
std::string buf;
@@ -3508,6 +3739,7 @@
setup_keys(password);
return true;
+#endif
}
/*!
@@ -3522,11 +3754,14 @@
*/
bool wallet2::verify_password(const epee::wipeable_string& password)
{
+ return {};
+#if 0
// this temporary unlocking is necessary for Windows (otherwise the file couldn't be loaded).
unlock_keys_file();
bool r = verify_password(m_keys_file, password, m_watch_only || m_multisig, m_account.get_device(), m_kdf_rounds);
lock_keys_file();
return r;
+#endif
}
/*!
@@ -3544,6 +3779,8 @@
*/
bool wallet2::verify_password(const std::string& keys_file_name, const epee::wipeable_string& password, bool no_spend_key, hw::device &hwdev, uint64_t kdf_rounds)
{
+ return {};
+#if 0
rapidjson::Document json;
wallet2::keys_file_data keys_file_data;
std::string buf;
@@ -3587,45 +3824,57 @@
if(!no_spend_key)
r = r && hwdev.verify_keys(keys.m_spend_secret_key, keys.m_account_address.m_spend_public_key);
return r;
+#endif
}
void wallet2::encrypt_keys(const crypto::chacha_key &key)
{
+#if 0
m_account.encrypt_keys(key);
m_account.decrypt_viewkey(key);
+#endif
}
void wallet2::decrypt_keys(const crypto::chacha_key &key)
{
+#if 0
m_account.encrypt_viewkey(key);
m_account.decrypt_keys(key);
+#endif
}
void wallet2::encrypt_keys(const epee::wipeable_string &password)
{
+#if 0
crypto::chacha_key key;
crypto::generate_chacha_key(password.data(), password.size(), key, m_kdf_rounds);
encrypt_keys(key);
+#endif
}
void wallet2::decrypt_keys(const epee::wipeable_string &password)
{
+#if 0
crypto::chacha_key key;
crypto::generate_chacha_key(password.data(), password.size(), key, m_kdf_rounds);
decrypt_keys(key);
+#endif
}
void wallet2::setup_new_blockchain()
{
+#if 0
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx);
add_subaddress_account(tr("Primary account"));
+#endif
}
void wallet2::create_keys_file(const std::string &wallet_, bool watch_only, const epee::wipeable_string &password, bool create_address_file)
{
+#if 0
if (!wallet_.empty())
{
bool r = store_keys(m_keys_file, password, watch_only);
@@ -3637,6 +3886,7 @@
if(!r) MERROR("String with address text not saved");
}
}
+#endif
}
@@ -3652,6 +3902,8 @@
*/
bool wallet2::query_device(hw::device::device_type& device_type, const std::string& keys_file_name, const epee::wipeable_string& password, uint64_t kdf_rounds)
{
+ return {};
+#if 0
rapidjson::Document json;
wallet2::keys_file_data keys_file_data;
std::string buf;
@@ -3692,6 +3944,7 @@
r = epee::serialization::load_t_from_binary(account_data_check, account_data);
if (!r) return false;
return true;
+#endif
}
/*!
@@ -3704,6 +3957,7 @@
void wallet2::generate(const std::string& wallet_, const epee::wipeable_string& password,
const epee::wipeable_string& multisig_data, bool create_address_file)
{
+#if 0
clear();
prepare_file_names(wallet_);
@@ -3776,6 +4030,7 @@
if (!wallet_.empty())
store();
+#endif
}
/*!
@@ -3791,6 +4046,8 @@
crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wipeable_string& password,
const crypto::secret_key& recovery_param, bool recover, bool two_random, bool create_address_file)
{
+ return {};
+#if 0
clear();
prepare_file_names(wallet_);
@@ -3824,6 +4081,7 @@
store();
return retval;
+#endif
}
uint64_t wallet2::estimate_blockchain_height()
@@ -3880,6 +4138,7 @@
const cryptonote::account_public_address &account_public_address,
const crypto::secret_key& viewkey, bool create_address_file)
{
+#if 0
clear();
prepare_file_names(wallet_);
@@ -3905,6 +4164,7 @@
if (!wallet_.empty())
store();
+#endif
}
/*!
@@ -3920,6 +4180,7 @@
const cryptonote::account_public_address &account_public_address,
const crypto::secret_key& spendkey, const crypto::secret_key& viewkey, bool create_address_file)
{
+#if 0
clear();
prepare_file_names(wallet_);
@@ -3945,6 +4206,7 @@
if (!wallet_.empty())
store();
+#endif
}
/*!
@@ -3955,6 +4217,7 @@
*/
void wallet2::restore(const std::string& wallet_, const epee::wipeable_string& password, const std::string &device_name, bool create_address_file)
{
+#if 0
clear();
prepare_file_names(wallet_);
@@ -3988,6 +4251,7 @@
if (!wallet_.empty()) {
store();
}
+#endif
}
std::string wallet2::make_multisig(const epee::wipeable_string &password,
@@ -3995,6 +4259,8 @@
const std::vector<crypto::public_key> &spend_keys,
uint32_t threshold)
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(!view_keys.empty(), "empty view keys");
CHECK_AND_ASSERT_THROW_MES(view_keys.size() == spend_keys.size(), "Mismatched view/spend key sizes");
CHECK_AND_ASSERT_THROW_MES(threshold > 1 && threshold <= spend_keys.size() + 1, "Invalid threshold");
@@ -4115,11 +4381,14 @@
store();
return extra_multisig_info;
+#endif
}
std::string wallet2::exchange_multisig_keys(const epee::wipeable_string &password,
const std::vector<std::string> &info)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(info.empty(),
error::wallet_internal_error, "Empty multisig info");
@@ -4136,12 +4405,15 @@
error::wallet_internal_error, "Bad extra multisig info");
return exchange_multisig_keys(password, pkeys, signers);
+#endif
}
std::string wallet2::exchange_multisig_keys(const epee::wipeable_string &password,
std::unordered_set<crypto::public_key> derivations,
std::vector<crypto::public_key> signers)
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(!derivations.empty(), "empty pkeys");
CHECK_AND_ASSERT_THROW_MES(!signers.empty(), "empty signers");
@@ -4249,12 +4521,14 @@
create_keys_file(m_wallet_file, false, password, boost::filesystem::exists(m_wallet_file + ".address.txt"));
return extra_multisig_info;
+#endif
}
void wallet2::unpack_multisig_info(const std::vector<std::string>& info,
std::vector<crypto::public_key> &public_keys,
std::vector<crypto::secret_key> &secret_keys) const
{
+#if 0
// parse all multisig info
public_keys.resize(info.size());
secret_keys.resize(info.size());
@@ -4301,28 +4575,37 @@
"Found local spend public key, but not local view secret key - something very weird");
}
}
+#endif
}
std::string wallet2::make_multisig(const epee::wipeable_string &password,
const std::vector<std::string> &info,
uint32_t threshold)
{
+ return {};
+#if 0
std::vector<crypto::secret_key> secret_keys(info.size());
std::vector<crypto::public_key> public_keys(info.size());
unpack_multisig_info(info, public_keys, secret_keys);
return make_multisig(password, secret_keys, public_keys, threshold);
+#endif
}
bool wallet2::finalize_multisig(const epee::wipeable_string &password, std::unordered_set<crypto::public_key> pkeys, std::vector<crypto::public_key> signers)
{
+ return {};
+#if 0
exchange_multisig_keys(password, pkeys, signers);
return true;
+#endif
}
bool wallet2::unpack_extra_multisig_info(const std::vector<std::string>& info,
std::vector<crypto::public_key> &signers,
std::unordered_set<crypto::public_key> &pkeys) const
{
+ return {};
+#if 0
// parse all multisig info
signers.resize(info.size(), crypto::null_pkey);
for (size_t i = 0; i < info.size(); ++i)
@@ -4334,10 +4617,13 @@
}
return true;
+#endif
}
bool wallet2::finalize_multisig(const epee::wipeable_string &password, const std::vector<std::string> &info)
{
+ return {};
+#if 0
std::unordered_set<crypto::public_key> public_keys;
std::vector<crypto::public_key> signers;
if (!unpack_extra_multisig_info(info, signers, public_keys))
@@ -4347,10 +4633,13 @@
}
return finalize_multisig(password, public_keys, signers);
+#endif
}
std::string wallet2::get_multisig_info() const
{
+ return {};
+#if 0
// It's a signed package of private view key and public spend key
const crypto::secret_key skey = cryptonote::get_multisig_blinded_secret_key(get_account().get_keys().m_view_secret_key);
const crypto::public_key pkey = get_multisig_signer_public_key(get_account().get_keys().m_spend_secret_key);
@@ -4366,10 +4655,13 @@
crypto::generate_signature(hash, pkey, get_multisig_blinded_secret_key(get_account().get_keys().m_spend_secret_key), signature);
return std::string("MultisigV1") + tools::base58::encode(data);
+#endif
}
bool wallet2::verify_multisig_info(const std::string &data, crypto::secret_key &skey, crypto::public_key &pkey)
{
+ return {};
+#if 0
const size_t header_len = strlen("MultisigV1");
if (data.size() < header_len || data.substr(0, header_len) != "MultisigV1")
{
@@ -4404,10 +4696,13 @@
}
return true;
+#endif
}
bool wallet2::verify_extra_multisig_info(const std::string &data, std::unordered_set<crypto::public_key> &pkeys, crypto::public_key &signer)
{
+ return {};
+#if 0
if (data.size() < MULTISIG_EXTRA_INFO_MAGIC.size() || data.substr(0, MULTISIG_EXTRA_INFO_MAGIC.size()) != MULTISIG_EXTRA_INFO_MAGIC)
{
MERROR("Multisig info header check error");
@@ -4452,10 +4747,13 @@
}
return true;
+#endif
}
bool wallet2::multisig(bool *ready, uint32_t *threshold, uint32_t *total) const
{
+ return {};
+#if 0
if (!m_multisig)
return false;
if (threshold)
@@ -4465,24 +4763,31 @@
if (ready)
*ready = !(get_account().get_keys().m_account_address.m_spend_public_key == rct::rct2pk(rct::identity()));
return true;
+#endif
}
bool wallet2::has_multisig_partial_key_images() const
{
+ return {};
+#if 0
if (!m_multisig)
return false;
for (const auto &td: m_transfers)
if (td.m_key_image_partial)
return true;
return false;
+#endif
}
bool wallet2::has_unknown_key_images() const
{
+ return {};
+#if 0
for (const auto &td: m_transfers)
if (!td.m_key_image_known)
return true;
return false;
+#endif
}
/*!
@@ -4492,6 +4797,7 @@
*/
void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_string& password)
{
+#if 0
if (wallet_name.empty())
return;
prepare_file_names(wallet_name);
@@ -4499,6 +4805,7 @@
THROW_WALLET_EXCEPTION_IF(!boost::filesystem::exists(m_keys_file, ignored_ec), error::file_not_found, m_keys_file);
bool r = store_keys(m_keys_file, password, m_watch_only);
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_keys_file);
+#endif
}
/*!
* \brief Writes to a file named based on the normal wallet (doesn't generate key, assumes it's already there)
@@ -4508,6 +4815,7 @@
*/
void wallet2::write_watch_only_wallet(const std::string& wallet_name, const epee::wipeable_string& password, std::string &new_keys_filename)
{
+#if 0
prepare_file_names(wallet_name);
boost::system::error_code ignored_ec;
new_keys_filename = m_wallet_file + "-watchonly.keys";
@@ -4515,25 +4823,33 @@
THROW_WALLET_EXCEPTION_IF(watch_only_keys_file_exists, error::file_save_error, new_keys_filename);
bool r = store_keys(new_keys_filename, password, true);
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, new_keys_filename);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::wallet_exists(const std::string& file_path, bool& keys_file_exists, bool& wallet_file_exists)
{
+#if 0
std::string keys_file, wallet_file;
do_prepare_file_names(file_path, keys_file, wallet_file);
boost::system::error_code ignore;
keys_file_exists = boost::filesystem::exists(keys_file, ignore);
wallet_file_exists = boost::filesystem::exists(wallet_file, ignore);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::wallet_valid_path_format(const std::string& file_path)
{
+ return {};
+#if 0
return !file_path.empty();
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id)
{
+ return {};
+#if 0
cryptonote::blobdata payment_id_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(payment_id_str, payment_id_data))
return false;
@@ -4543,10 +4859,13 @@
payment_id = *reinterpret_cast<const crypto::hash*>(payment_id_data.data());
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_short_payment_id(const std::string& payment_id_str, crypto::hash8& payment_id)
{
+ return {};
+#if 0
cryptonote::blobdata payment_id_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(payment_id_str, payment_id_data))
return false;
@@ -4556,10 +4875,13 @@
payment_id = *reinterpret_cast<const crypto::hash8*>(payment_id_data.data());
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_payment_id(const std::string& payment_id_str, crypto::hash& payment_id)
{
+ return {};
+#if 0
if (parse_long_payment_id(payment_id_str, payment_id))
return true;
crypto::hash8 payment_id8;
@@ -4570,16 +4892,22 @@
return true;
}
return false;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::prepare_file_names(const std::string& file_path)
{
+ return {};
+#if 0
do_prepare_file_names(file_path, m_keys_file, m_wallet_file);
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::check_connection(uint32_t *version, uint32_t timeout)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(!m_is_initialized, error::wallet_not_initialized);
boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex);
@@ -4613,21 +4941,28 @@
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const
{
+ return {};
+#if 0
hw::device &hwdev = m_account.get_device();
return hwdev.generate_chacha_key(m_account.get_keys(), key, m_kdf_rounds);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::generate_chacha_key_from_password(const epee::wipeable_string &pass, crypto::chacha_key &key) const
{
+#if 0
crypto::generate_chacha_key(pass.data(), pass.size(), key, m_kdf_rounds);
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::load(const std::string& wallet_, const epee::wipeable_string& password)
{
+#if 0
clear();
prepare_file_names(wallet_);
@@ -4767,10 +5102,12 @@
{
MERROR("Failed to save rings, will try again next time");
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::trim_hashchain()
{
+#if 0
uint64_t height = m_checkpoints.get_max_height();
for (const transfer_details &td: m_transfers)
@@ -4803,26 +5140,35 @@
MDEBUG("trimming to " << height << ", offset " << m_blockchain.offset());
m_blockchain.trim(height);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::check_genesis(const crypto::hash& genesis_hash) const {
+#if 0
std::string what("Genesis block mismatch. You probably use wallet without testnet (or stagenet) flag with blockchain from test (or stage) network or vice versa");
THROW_WALLET_EXCEPTION_IF(genesis_hash != m_blockchain.genesis(), error::wallet_internal_error, what);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::path() const
{
+ return {};
+#if 0
return m_wallet_file;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::store()
{
+#if 0
store_to("", epee::wipeable_string());
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::store_to(const std::string &path, const epee::wipeable_string &password)
{
+#if 0
trim_hashchain();
// if file is the same, we do:
@@ -4926,20 +5272,26 @@
std::error_code e = tools::replace_file(new_file, m_wallet_file);
THROW_WALLET_EXCEPTION_IF(e, error::file_save_error, m_wallet_file, e);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::balance(uint32_t index_major) const
{
+ return {};
+#if 0
uint64_t amount = 0;
if(m_light_wallet)
return m_light_wallet_unlocked_balance;
for (const auto& i : balance_per_subaddress(index_major))
amount += i.second;
return amount;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::unlocked_balance(uint32_t index_major, uint64_t *blocks_to_unlock)
{
+ return {};
+#if 0
uint64_t amount = 0;
if (blocks_to_unlock)
*blocks_to_unlock = 0;
@@ -4952,10 +5304,13 @@
*blocks_to_unlock = i.second.second;
}
return amount;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_major) const
{
+ return {};
+#if 0
std::map<uint32_t, uint64_t> amount_per_subaddr;
for (const auto& td: m_transfers)
{
@@ -4981,10 +5336,13 @@
}
}
return amount_per_subaddr;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::map<uint32_t, std::pair<uint64_t, uint64_t>> wallet2::unlocked_balance_per_subaddress(uint32_t index_major)
{
+ return {};
+#if 0
std::map<uint32_t, std::pair<uint64_t, uint64_t>> amount_per_subaddr;
const uint64_t blockchain_height = get_blockchain_current_height();
for(const transfer_details& td: m_transfers)
@@ -5016,18 +5374,24 @@
}
}
return amount_per_subaddr;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::balance_all() const
{
+ return {};
+#if 0
uint64_t r = 0;
for (uint32_t index_major = 0; index_major < get_num_subaddress_accounts(); ++index_major)
r += balance(index_major);
return r;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::unlocked_balance_all(uint64_t *blocks_to_unlock)
{
+ return {};
+#if 0
uint64_t r = 0;
if (blocks_to_unlock)
*blocks_to_unlock = 0;
@@ -5039,15 +5403,19 @@
*blocks_to_unlock = std::max(*blocks_to_unlock, local_blocks_to_unlock);
}
return r;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_transfers(wallet2::transfer_container& incoming_transfers) const
{
+#if 0
incoming_transfers = m_transfers;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_payments(const crypto::hash& payment_id, std::list<wallet2::payment_details>& payments, uint64_t min_height, const boost::optional<uint32_t>& subaddr_account, const std::set<uint32_t>& subaddr_indices) const
{
+#if 0
auto range = m_payments.equal_range(payment_id);
std::for_each(range.first, range.second, [&payments, &min_height, &subaddr_account, &subaddr_indices](const payment_container::value_type& x) {
if (min_height < x.second.m_block_height &&
@@ -5057,10 +5425,12 @@
payments.push_back(x.second);
}
});
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_payments(std::list<std::pair<crypto::hash,wallet2::payment_details>>& payments, uint64_t min_height, uint64_t max_height, const boost::optional<uint32_t>& subaddr_account, const std::set<uint32_t>& subaddr_indices) const
{
+#if 0
auto range = std::make_pair(m_payments.begin(), m_payments.end());
std::for_each(range.first, range.second, [&payments, &min_height, &max_height, &subaddr_account, &subaddr_indices](const payment_container::value_type& x) {
if (min_height < x.second.m_block_height && max_height >= x.second.m_block_height &&
@@ -5070,11 +5440,13 @@
payments.push_back(x);
}
});
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_payments_out(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
uint64_t min_height, uint64_t max_height, const boost::optional<uint32_t>& subaddr_account, const std::set<uint32_t>& subaddr_indices) const
{
+#if 0
for (auto i = m_confirmed_txs.begin(); i != m_confirmed_txs.end(); ++i) {
if (i->second.m_block_height <= min_height || i->second.m_block_height > max_height)
continue;
@@ -5084,10 +5456,12 @@
continue;
confirmed_payments.push_back(*i);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account, const std::set<uint32_t>& subaddr_indices) const
{
+#if 0
for (auto i = m_unconfirmed_txs.begin(); i != m_unconfirmed_txs.end(); ++i) {
if (subaddr_account && *subaddr_account != i->second.m_subaddr_account)
continue;
@@ -5095,19 +5469,23 @@
continue;
unconfirmed_payments.push_back(*i);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account, const std::set<uint32_t>& subaddr_indices) const
{
+#if 0
for (auto i = m_unconfirmed_payments.begin(); i != m_unconfirmed_payments.end(); ++i) {
if ((!subaddr_account || *subaddr_account == i->second.m_pd.m_subaddr_index.major) &&
(subaddr_indices.empty() || subaddr_indices.count(i->second.m_pd.m_subaddr_index.minor) == 1))
unconfirmed_payments.push_back(*i);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::rescan_spent()
{
+#if 0
// This is RPC call that can take a long time if there are many outputs,
// so we call it several times, in stripes, so we don't time out spuriously
std::vector<int> spent_status;
@@ -5156,25 +5534,33 @@
}
}
}
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::rescan_blockchain(bool refresh)
{
+#if 0
clear();
setup_new_blockchain();
if (refresh)
this->refresh(false);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::is_transfer_unlocked(const transfer_details& td)
{
+ return {};
+#if 0
return is_transfer_unlocked(td.m_tx.unlock_time, td.m_block_height);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height)
{
+ return {};
+#if 0
if(!is_tx_spendtime_unlocked(unlock_time, block_height))
return false;
@@ -5182,10 +5568,13 @@
return false;
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height)
{
+ return {};
+#if 0
if(unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
{
//interpret as block index
@@ -5209,6 +5598,7 @@
return false;
}
return false;
+#endif
}
//----------------------------------------------------------------------------------------------------
namespace
@@ -5268,6 +5658,8 @@
// their ordering, but it could become more murky if we add scores later.
float wallet2::get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const
{
+ return {};
+#if 0
int dh;
// expensive test, and same tx will fall onto the same block height below
@@ -5291,10 +5683,13 @@
// don't think these are particularly related
return 0.0f;
+#endif
}
//----------------------------------------------------------------------------------------------------
size_t wallet2::pop_best_value_from(const transfer_container &transfers, std::vector<size_t> &unused_indices, const std::vector<size_t>& selected_transfers, bool smallest) const
{
+ return {};
+#if 0
std::vector<size_t> candidates;
float best_relatedness = 1.0f;
for (size_t n = 0; n < unused_indices.size(); ++n)
@@ -5340,11 +5735,15 @@
idx = crypto::rand_idx(candidates.size());
}
return pop_index (unused_indices, candidates[idx]);
+#endif
}
//----------------------------------------------------------------------------------------------------
size_t wallet2::pop_best_value(std::vector<size_t> &unused_indices, const std::vector<size_t>& selected_transfers, bool smallest) const
{
+ return {};
+#if 0
return pop_best_value_from(m_transfers, unused_indices, selected_transfers, smallest);
+#endif
}
//----------------------------------------------------------------------------------------------------
// Select random input sources for transaction.
@@ -5353,6 +5752,8 @@
// modified reference: selected_transfers, a list of iterators/indices of input sources
uint64_t wallet2::select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers) const
{
+ return {};
+#if 0
uint64_t found_money = 0;
selected_transfers.reserve(unused_transfers_indices.size());
while (found_money < needed_money && !unused_transfers_indices.empty())
@@ -5365,10 +5766,12 @@
}
return found_money;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices)
{
+#if 0
unconfirmed_transfer_details& utd = m_unconfirmed_txs[cryptonote::get_transaction_hash(tx)];
utd.m_amount_in = amount_in;
utd.m_amount_out = 0;
@@ -5391,11 +5794,14 @@
const auto &txin = boost::get<cryptonote::txin_to_key>(in);
utd.m_rings.push_back(std::make_pair(txin.k_image, txin.key_offsets));
}
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::hash wallet2::get_payment_id(const pending_tx &ptx) const
{
+ return {};
+#if 0
std::vector<tx_extra_field> tx_extra_fields;
parse_tx_extra(ptx.tx.extra, tx_extra_fields); // ok if partially parsed
tx_extra_nonce extra_nonce;
@@ -5421,12 +5827,14 @@
}
}
return payment_id;
+#endif
}
//----------------------------------------------------------------------------------------------------
// take a pending tx and actually send it to the daemon
void wallet2::commit_tx(pending_tx& ptx)
{
+#if 0
using namespace cryptonote;
if(m_light_wallet)
@@ -5500,27 +5908,35 @@
<< "Balance: " << print_money(balance(ptx.construction_data.subaddr_account)) << ENDL
<< "Unlocked: " << print_money(unlocked_balance(ptx.construction_data.subaddr_account)) << ENDL
<< "Please, wait for confirmation for your balance to be unlocked.");
+#endif
}
void wallet2::commit_tx(std::vector<pending_tx>& ptx_vector)
{
+#if 0
for (auto & ptx : ptx_vector)
{
commit_tx(ptx);
}
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename) const
{
+ return {};
+#if 0
LOG_PRINT_L0("saving " << ptx_vector.size() << " transactions");
std::string ciphertext = dump_tx_to_str(ptx_vector);
if (ciphertext.empty())
return false;
return epee::file_io_utils::save_string_to_file(filename, ciphertext);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::dump_tx_to_str(const std::vector<pending_tx> &ptx_vector) const
{
+ return {};
+#if 0
LOG_PRINT_L0("saving " << ptx_vector.size() << " transactions");
unsigned_tx_set txs;
for (auto &tx: ptx_vector)
@@ -5546,10 +5962,13 @@
LOG_PRINT_L2("Saving unsigned tx data: " << oss.str());
std::string ciphertext = encrypt_with_view_secret_key(oss.str());
return std::string(UNSIGNED_TX_PREFIX) + ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const
{
+ return {};
+#if 0
std::string s;
boost::system::error_code errcode;
@@ -5565,10 +5984,13 @@
}
return parse_unsigned_tx_from_str(s, exported_txs);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const
{
+ return {};
+#if 0
std::string s = unsigned_tx_st;
const size_t magiclen = strlen(UNSIGNED_TX_PREFIX) - 1;
if (strncmp(s.c_str(), UNSIGNED_TX_PREFIX, magiclen))
@@ -5624,10 +6046,13 @@
LOG_PRINT_L1("Loaded tx unsigned data from binary: " << exported_txs.txes.size() << " transactions");
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::vector<wallet2::pending_tx> &txs, std::function<bool(const unsigned_tx_set&)> accept_func, bool export_raw)
{
+ return {};
+#if 0
unsigned_tx_set exported_txs;
if(!load_unsigned_tx(unsigned_filename, exported_txs))
return false;
@@ -5638,10 +6063,13 @@
return false;
}
return sign_tx(exported_txs, signed_filename, txs, export_raw);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &txs, signed_tx_set &signed_txes)
{
+ return {};
+#if 0
import_outputs(exported_txs.transfers);
// sign the transactions
@@ -5715,10 +6143,13 @@
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &txs, bool export_raw)
{
+ return {};
+#if 0
// sign the transactions
signed_tx_set signed_txes;
std::string ciphertext = sign_tx_dump_to_str(exported_txs, txs, signed_txes);
@@ -5748,10 +6179,13 @@
}
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::sign_tx_dump_to_str(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &ptx, signed_tx_set &signed_txes)
{
+ return {};
+#if 0
// sign the transactions
bool r = sign_tx(exported_txs, ptx, signed_txes);
if (!r)
@@ -5774,10 +6208,13 @@
LOG_PRINT_L3("Saving signed tx data (with encryption): " << oss.str());
std::string ciphertext = encrypt_with_view_secret_key(oss.str());
return std::string(SIGNED_TX_PREFIX) + ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func)
{
+ return {};
+#if 0
std::string s;
boost::system::error_code errcode;
signed_tx_set signed_txs;
@@ -5795,10 +6232,13 @@
}
return parse_tx_from_str(s, ptx, accept_func);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_tx_from_str(const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set &)> accept_func)
{
+ return {};
+#if 0
std::string s = signed_tx_st;
boost::system::error_code errcode;
signed_tx_set signed_txs;
@@ -5884,10 +6324,13 @@
ptx = signed_txs.ptx;
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::save_multisig_tx(multisig_tx_set txs)
{
+ return {};
+#if 0
LOG_PRINT_L0("saving " << txs.m_ptx.size() << " multisig transactions");
// txes generated, get rid of used k values
@@ -5922,18 +6365,24 @@
LOG_PRINT_L2("Saving multisig unsigned tx data: " << oss.str());
std::string ciphertext = encrypt_with_view_secret_key(oss.str());
return std::string(MULTISIG_UNSIGNED_TX_PREFIX) + ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::save_multisig_tx(const multisig_tx_set &txs, const std::string &filename)
{
+ return {};
+#if 0
std::string ciphertext = save_multisig_tx(txs);
if (ciphertext.empty())
return false;
return epee::file_io_utils::save_string_to_file(filename, ciphertext);
+#endif
}
//----------------------------------------------------------------------------------------------------
wallet2::multisig_tx_set wallet2::make_multisig_tx_set(const std::vector<pending_tx>& ptx_vector) const
{
+ return {};
+#if 0
multisig_tx_set txs;
txs.m_ptx = ptx_vector;
@@ -5945,23 +6394,32 @@
txs.m_signers.insert(get_multisig_signer_public_key());
return txs;
+#endif
}
std::string wallet2::save_multisig_tx(const std::vector<pending_tx>& ptx_vector)
{
+ return {};
+#if 0
return save_multisig_tx(make_multisig_tx_set(ptx_vector));
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::save_multisig_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename)
{
+ return {};
+#if 0
std::string ciphertext = save_multisig_tx(ptx_vector);
if (ciphertext.empty())
return false;
return epee::file_io_utils::save_string_to_file(filename, ciphertext);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::load_multisig_tx(cryptonote::blobdata s, multisig_tx_set &exported_txs, std::function<bool(const multisig_tx_set&)> accept_func)
{
+ return {};
+#if 0
const size_t magiclen = strlen(MULTISIG_UNSIGNED_TX_PREFIX);
if (strncmp(s.c_str(), MULTISIG_UNSIGNED_TX_PREFIX, magiclen))
{
@@ -6025,10 +6483,13 @@
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::load_multisig_tx_from_file(const std::string &filename, multisig_tx_set &exported_txs, std::function<bool(const multisig_tx_set&)> accept_func)
{
+ return {};
+#if 0
std::string s;
boost::system::error_code errcode;
@@ -6049,10 +6510,13 @@
return false;
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto::hash> &txids)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(exported_txs.m_ptx.empty(), error::wallet_internal_error, "No tx found");
const crypto::public_key local_signer = get_multisig_signer_public_key();
@@ -6181,18 +6645,24 @@
exported_txs.m_signers.insert(get_multisig_signer_public_key());
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector<crypto::hash> &txids)
{
+ return {};
+#if 0
bool r = sign_multisig_tx(exported_txs, txids);
if (!r)
return false;
return save_multisig_tx(exported_txs, filename);
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::sign_multisig_tx_from_file(const std::string &filename, std::vector<crypto::hash> &txids, std::function<bool(const multisig_tx_set&)> accept_func)
{
+ return {};
+#if 0
multisig_tx_set exported_txs;
if(!load_multisig_tx_from_file(filename, exported_txs))
return false;
@@ -6203,10 +6673,13 @@
return false;
}
return sign_multisig_tx_to_file(exported_txs, filename, txids);
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_fee_multiplier(uint32_t priority, int fee_algorithm) const
{
+ return {};
+#if 0
static const struct
{
size_t count;
@@ -6244,41 +6717,56 @@
THROW_WALLET_EXCEPTION_IF (false, error::invalid_priority);
return 1;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_per_kb_fee() const
{
+ return {};
+#if 0
if(m_light_wallet)
return m_light_wallet_per_kb_fee;
return FEE_PER_KB;
+#endif
}
//----------------------------------------------------------------------------------------------------
int wallet2::get_fee_algorithm() const
{
+ return {};
+#if 0
// changes at v3 and v5
if (use_fork_rules(5, 0))
return 2;
if (use_fork_rules(3, -720 * 14))
return 1;
return 0;
+#endif
}
//------------------------------------------------------------------------------------------------------------------------------
uint64_t wallet2::get_min_ring_size() const
{
+ return {};
+#if 0
if (use_fork_rules(8, 10))
return 3;
return 0;
+#endif
}
//------------------------------------------------------------------------------------------------------------------------------
uint64_t wallet2::get_max_ring_size() const
{
+ return {};
+#if 0
if (use_fork_rules(8, 10))
return 3;
return 0;
+#endif
}
//------------------------------------------------------------------------------------------------------------------------------
uint64_t wallet2::adjust_ring_size(uint64_t ring_size) const
{
+ return {};
+#if 0
if (use_fork_rules(8, 10))
{
const uint64_t min_ring_size = get_min_ring_size();
@@ -6303,10 +6791,13 @@
}
}
return ring_size;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint32_t wallet2::adjust_priority(uint32_t priority)
{
+ return {};
+#if 0
if (priority == 0 && m_default_priority == 0 && auto_low_priority())
{
try
@@ -6376,10 +6867,13 @@
}
}
return priority;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::set_ring_database(const std::string &filename)
{
+ return {};
+#if 0
m_ring_database = filename;
MINFO("ringdb path set to " << filename);
m_ringdb.reset();
@@ -6399,10 +6893,13 @@
}
}
return true;
+#endif
}
crypto::chacha_key wallet2::get_ringdb_key()
{
+ return {};
+#if 0
if (!m_ringdb_key)
{
MINFO("caching ringdb key");
@@ -6411,40 +6908,55 @@
m_ringdb_key = key;
}
return *m_ringdb_key;
+#endif
}
bool wallet2::add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->add_rings(key, tx); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::add_rings(const cryptonote::transaction_prefix &tx)
{
+ return {};
+#if 0
try { return add_rings(get_ringdb_key(), tx); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->remove_rings(get_ringdb_key(), tx); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->get_ring(key, key_image, outs); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::get_rings(const crypto::hash &txid, std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &outs)
{
+ return {};
+#if 0
for (auto i: m_confirmed_txs)
{
if (txid == i.first)
@@ -6464,25 +6976,34 @@
}
}
return false;
+#endif
}
bool wallet2::get_ring(const crypto::key_image &key_image, std::vector<uint64_t> &outs)
{
+ return {};
+#if 0
try { return get_ring(get_ringdb_key(), key_image, outs); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->set_ring(get_ringdb_key(), key_image, outs, relative); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::find_and_save_rings(bool force)
{
+ return {};
+#if 0
if (!force && m_ring_history_saved)
return true;
if (!m_ringdb)
@@ -6548,18 +7069,24 @@
MINFO("Found and saved rings for " << txs_hashes.size() << " transactions");
m_ring_history_saved = true;
return true;
+#endif
}
bool wallet2::blackball_output(const std::pair<uint64_t, uint64_t> &output)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->blackball(output); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::set_blackballed_outputs(const std::vector<std::pair<uint64_t, uint64_t>> &outputs, bool add)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try
@@ -6571,26 +7098,35 @@
return ret;
}
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::unblackball_output(const std::pair<uint64_t, uint64_t> &output)
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->unblackball(output); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::is_output_blackballed(const std::pair<uint64_t, uint64_t> &output) const
{
+ return {};
+#if 0
if (!m_ringdb)
return false;
try { return m_ringdb->blackballed(output); }
catch (const std::exception &e) { return false; }
+#endif
}
bool wallet2::lock_keys_file()
{
+ return {};
+#if 0
if (m_keys_file_locker)
{
MDEBUG(m_keys_file << " is already locked.");
@@ -6598,10 +7134,13 @@
}
m_keys_file_locker.reset(new tools::file_locker(m_keys_file));
return true;
+#endif
}
bool wallet2::unlock_keys_file()
{
+ return {};
+#if 0
if (!m_keys_file_locker)
{
MDEBUG(m_keys_file << " is already unlocked.");
@@ -6609,15 +7148,21 @@
}
m_keys_file_locker.reset();
return true;
+#endif
}
bool wallet2::is_keys_file_locked() const
{
+ return {};
+#if 0
return m_keys_file_locker->locked();
+#endif
}
bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& output_public_key, const rct::key& mask, uint64_t real_index, bool unlocked) const
{
+ return {};
+#if 0
if (!unlocked) // don't add locked outs
return false;
if (global_index == real_index) // don't re-add real one
@@ -6630,9 +7175,11 @@
// return false;
outs.back().push_back(item);
return true;
+#endif
}
void wallet2::light_wallet_get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count) {
+#if 0
MDEBUG("LIGHTWALLET - Getting random outs");
@@ -6734,10 +7281,12 @@
MTRACE(std::get<0>(added_out));
}
+#endif
}
void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count)
{
+#if 0
LOG_PRINT_L2("fake_outputs_count: " << fake_outputs_count);
outs.clear();
@@ -7383,6 +7932,7 @@
if (!set_ring(td.m_key_image, ring, false))
MERROR("Failed to set ring for " << td.m_key_image);
}
+#endif
}
template<typename T>
@@ -7390,6 +7940,7 @@
std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs,
uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, T destination_split_strategy, const tx_dust_policy& dust_policy, cryptonote::transaction& tx, pending_tx &ptx, bool v1_borromean)
{
+#if 0
using namespace cryptonote;
// throw if attempting a transaction with no destinations
THROW_WALLET_EXCEPTION_IF(dsts.empty(), error::zero_destination);
@@ -7661,12 +8212,14 @@
for (size_t idx: selected_transfers)
ptx.construction_data.subaddr_indices.insert(m_transfers[idx].m_subaddr_index.minor);
LOG_PRINT_L2("transfer_selected done");
+#endif
}
void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry> dsts, const std::vector<size_t>& selected_transfers, size_t fake_outputs_count,
std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs,
uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, cryptonote::transaction& tx, pending_tx &ptx, rct::RangeProofType range_proof_type)
{
+#if 0
using namespace cryptonote;
// throw if attempting a transaction with no destinations
THROW_WALLET_EXCEPTION_IF(dsts.empty(), error::zero_destination);
@@ -7944,10 +8497,13 @@
for (size_t idx: selected_transfers)
ptx.construction_data.subaddr_indices.insert(m_transfers[idx].m_subaddr_index.minor);
LOG_PRINT_L2("transfer_selected_rct done");
+#endif
}
std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices)
{
+ return {};
+#if 0
std::vector<size_t> picks;
float current_output_relatdness = 1.0f;
@@ -8004,10 +8560,13 @@
}
return picks;
+#endif
}
bool wallet2::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
{
+ return {};
+#if 0
if (!use_rct)
return false;
if (n_transfers > 1)
@@ -8037,10 +8596,13 @@
if (!found)
return false;
return true;
+#endif
}
std::vector<size_t> wallet2::get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const
{
+ return {};
+#if 0
std::vector<size_t> indices;
for (size_t n: unused_dust_indices)
if (m_transfers[n].is_rct())
@@ -8049,19 +8611,25 @@
if (m_transfers[n].is_rct())
indices.push_back(n);
return indices;
+#endif
}
static uint32_t get_count_above(const std::vector<wallet2::transfer_details> &transfers, const std::vector<size_t> &indices, uint64_t threshold)
{
+ return {};
+#if 0
uint32_t count = 0;
for (size_t idx: indices)
if (transfers[idx].amount() >= threshold)
++count;
return count;
+#endif
}
bool wallet2::light_wallet_login(bool &new_address)
{
+ return {};
+#if 0
MDEBUG("Light wallet login request");
m_light_wallet_connected = false;
cryptonote::COMMAND_RPC_LOGIN::request request;
@@ -8087,10 +8655,13 @@
// m_unconfirmed_payments.clear();
}
return m_light_wallet_connected;
+#endif
}
bool wallet2::light_wallet_import_wallet_request(cryptonote::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response)
{
+ return {};
+#if 0
MDEBUG("Light wallet import wallet request");
cryptonote::COMMAND_RPC_IMPORT_WALLET_REQUEST::request oreq;
oreq.address = get_account().get_public_address_str(m_nettype);
@@ -8102,10 +8673,12 @@
return true;
+#endif
}
void wallet2::light_wallet_get_unspent_outs()
{
+#if 0
MDEBUG("Getting unspent outs");
cryptonote::COMMAND_RPC_GET_UNSPENT_OUTS::request oreq;
@@ -8254,10 +8827,13 @@
m_key_images[td.m_key_image] = m_transfers.size()-1;
m_pub_keys[td.get_public_key()] = m_transfers.size()-1;
}
+#endif
}
bool wallet2::light_wallet_get_address_info(cryptonote::COMMAND_RPC_GET_ADDRESS_INFO::response &response)
{
+ return {};
+#if 0
MTRACE(__FUNCTION__);
cryptonote::COMMAND_RPC_GET_ADDRESS_INFO::request request;
@@ -8270,10 +8846,12 @@
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_address_info");
// TODO: Validate result
return true;
+#endif
}
void wallet2::light_wallet_get_address_txs()
{
+#if 0
MDEBUG("Refreshing light wallet");
cryptonote::COMMAND_RPC_GET_ADDRESS_TXS::request ireq;
@@ -8459,10 +9037,13 @@
m_light_wallet_unlocked_balance = ires.total_received_unlocked-wallet_total_sent;
else
m_light_wallet_unlocked_balance = m_light_wallet_balance;
+#endif
}
bool wallet2::light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const
{
+ return {};
+#if 0
// rct string is empty if output is non RCT
if (rct_string.empty())
return false;
@@ -8484,10 +9065,13 @@
sc_sub(decrypted_mask.bytes,encrypted_mask.bytes,rct::hash_to_scalar(rct::sk2rct(scalar)).bytes);
}
return true;
+#endif
}
bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index)
{
+ return {};
+#if 0
// Lookup key image from cache
std::map<uint64_t, crypto::key_image> index_keyimage_map;
std::unordered_map<crypto::public_key, std::map<uint64_t, crypto::key_image> >::const_iterator found_pub_key = m_key_image_cache.find(tx_public_key);
@@ -8527,6 +9111,7 @@
index_keyimage_map.emplace(out_index, calculated_key_image);
m_key_image_cache.emplace(tx_public_key, index_keyimage_map);
return key_image == calculated_key_image;
+#endif
}
// Another implementation of transaction creation that is hopefully better
@@ -8546,6 +9131,8 @@
// usable balance.
std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, size_t ring_size, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
{
+ return {};
+#if 0
//ensure device is let in NONE mode in any case
hw::device &hwdev = m_account.get_device();
boost::unique_lock<hw::device> hwdev_lock (hwdev);
@@ -9020,10 +9607,13 @@
// if we made it this far, we're OK to actually send the transactions
return ptx_vector;
+#endif
}
std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, size_t ring_size, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
{
+ return {};
+#if 0
if (ring_size == 0)
{
ring_size = DEFAULT_RING_SIZE;
@@ -9083,10 +9673,13 @@
}
return create_transactions_from(address, is_subaddress, unused_transfers_indices, unused_dust_indices, fake_outs_count, unlock_time, priority, extra);
+#endif
}
std::vector<wallet2::pending_tx> wallet2::create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, size_t ring_size, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra)
{
+ return {};
+#if 0
if (ring_size == 0)
{
ring_size = DEFAULT_RING_SIZE;
@@ -9109,10 +9702,13 @@
}
}
return create_transactions_from(address, is_subaddress, unused_transfers_indices, unused_dust_indices, fake_outs_count, unlock_time, priority, extra);
+#endif
}
std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra)
{
+ return {};
+#if 0
//ensure device is let in NONE mode in any case
hw::device &hwdev = m_account.get_device();
boost::unique_lock<hw::device> hwdev_lock (hwdev);
@@ -9277,16 +9873,21 @@
// if we made it this far, we're OK to actually send the transactions
return ptx_vector;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_hard_fork_info(uint8_t version, uint64_t &earliest_height) const
{
+#if 0
boost::optional<std::string> result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
throw_on_rpc_response_error(result, "get_hard_fork_info");
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks) const
{
+ return {};
+#if 0
// TODO: How to get fork rule info from light wallet node?
if(m_light_wallet)
return true;
@@ -9302,18 +9903,24 @@
else
LOG_PRINT_L2("Not using v" << (unsigned)version << " rules");
return close_enough;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_upper_transaction_weight_limit() const
{
+ return {};
+#if 0
if (m_upper_transaction_weight_limit > 0)
return m_upper_transaction_weight_limit;
uint64_t full_reward_zone = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1;
return full_reward_zone - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<size_t> wallet2::select_available_outputs(const std::function<bool(const transfer_details &td)> &f)
{
+ return {};
+#if 0
std::vector<size_t> outputs;
size_t n = 0;
for (transfer_container::const_iterator i = m_transfers.begin(); i != m_transfers.end(); ++i, ++n)
@@ -9328,10 +9935,13 @@
outputs.push_back(n);
}
return outputs;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<uint64_t> wallet2::get_unspent_amounts_vector() const
{
+ return {};
+#if 0
std::set<uint64_t> set;
for (const auto &td: m_transfers)
{
@@ -9345,10 +9955,13 @@
vector.push_back(i);
}
return vector;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct)
{
+ return {};
+#if 0
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request req_t = AUTO_VAL_INIT(req_t);
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response resp_t = AUTO_VAL_INIT(resp_t);
m_daemon_rpc_mutex.lock();
@@ -9384,10 +9997,13 @@
}
return false;
});
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_num_rct_outputs()
{
+ return {};
+#if 0
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request req_t = AUTO_VAL_INIT(req_t);
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response resp_t = AUTO_VAL_INIT(resp_t);
m_daemon_rpc_mutex.lock();
@@ -9405,28 +10021,40 @@
THROW_WALLET_EXCEPTION_IF(resp_t.histogram[0].amount != 0, error::get_histogram_error, "Expected 0 amount");
return resp_t.histogram[0].total_instances;
+#endif
}
//----------------------------------------------------------------------------------------------------
const wallet2::transfer_details &wallet2::get_transfer_details(size_t idx) const
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error, "Bad transfer index");
return m_transfers[idx];
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<size_t> wallet2::select_available_unmixable_outputs()
{
+ return {};
+#if 0
// request all outputs with less instances than the min ring size
return select_available_outputs_from_histogram(get_min_ring_size(), false, true, false);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<size_t> wallet2::select_available_mixable_outputs()
{
+ return {};
+#if 0
// request all outputs with at least as many instances as the min ring size
return select_available_outputs_from_histogram(get_min_ring_size(), true, true, true);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<wallet2::pending_tx> wallet2::create_unmixable_sweep_transactions()
{
+ return {};
+#if 0
// From hard fork 1, we don't consider small amounts to be dust anymore
const bool hf1_rules = use_fork_rules(2, 10); // first hard fork has version 2
tx_dust_policy dust_policy(hf1_rules ? 0 : ::config::DEFAULT_DUST_THRESHOLD);
@@ -9453,20 +10081,25 @@
}
return create_transactions_from(m_account_public_address, false, unmixable_transfer_outputs, unmixable_dust_outputs, 0 /*fake_outs_count */, 0 /* unlock_time */, 1 /*priority */, std::vector<uint8_t>());
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::discard_unmixable_outputs()
{
+#if 0
// may throw
std::vector<size_t> unmixable_outputs = select_available_unmixable_outputs();
for (size_t idx : unmixable_outputs)
{
m_transfers[idx].m_spent = true;
}
+#endif
}
bool wallet2::get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const
{
+ return {};
+#if 0
additional_tx_keys.clear();
const std::unordered_map<crypto::hash, crypto::secret_key>::const_iterator i = m_tx_keys.find(txid);
if (i == m_tx_keys.end())
@@ -9476,10 +10109,12 @@
if (j != m_additional_tx_keys.end())
additional_tx_keys = j->second;
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::set_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys)
{
+#if 0
// fetch tx from daemon and check if secret keys agree with corresponding public keys
COMMAND_RPC_GET_TRANSACTIONS::request req = AUTO_VAL_INIT(req);
req.txs_hashes.push_back(epee::string_tools::pod_to_hex(txid));
@@ -9524,10 +10159,13 @@
THROW_WALLET_EXCEPTION_IF(additional_tx_keys.size() != additional_tx_pub_keys.data.size(), error::wallet_internal_error, "The number of additional tx secret keys doesn't agree with the number of additional tx public keys in the blockchain" );
m_tx_keys.insert(std::make_pair(txid, tx_key));
m_additional_tx_keys.insert(std::make_pair(txid, additional_tx_keys));
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::get_spend_proof(const crypto::hash &txid, const std::string &message)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(m_watch_only, error::wallet_internal_error,
"get_spend_proof requires spend secret key and is not available for a watch-only wallet");
@@ -9642,10 +10280,13 @@
for (const crypto::signature& sig : ring_sig)
sig_str += tools::base58::encode(std::string((const char *)&sig, sizeof(crypto::signature)));
return sig_str;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::check_spend_proof(const crypto::hash &txid, const std::string &message, const std::string &sig_str)
{
+ return {};
+#if 0
const std::string header = "SpendProofV1";
const size_t header_len = header.size();
THROW_WALLET_EXCEPTION_IF(sig_str.size() < header_len || sig_str.substr(0, header_len) != header, error::wallet_internal_error,
@@ -9756,11 +10397,13 @@
}
THROW_WALLET_EXCEPTION_IF(sig_iter != signatures.cend(), error::wallet_internal_error, "Signature iterator didn't reach the end");
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations)
{
+#if 0
crypto::key_derivation derivation;
THROW_WALLET_EXCEPTION_IF(!crypto::generate_key_derivation(address.m_view_public_key, tx_key, derivation), error::wallet_internal_error,
"Failed to generate key derivation from supplied parameters");
@@ -9772,10 +10415,12 @@
"Failed to generate key derivation from supplied parameters");
check_tx_key_helper(txid, derivation, additional_derivations, address, received, in_pool, confirmations);
+#endif
}
void wallet2::check_tx_key_helper(const crypto::hash &txid, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations)
{
+#if 0
COMMAND_RPC_GET_TRANSACTIONS::request req;
COMMAND_RPC_GET_TRANSACTIONS::response res;
req.txs_hashes.push_back(epee::string_tools::pod_to_hex(txid));
@@ -9860,10 +10505,13 @@
if (err.empty())
confirmations = bc_height - res.txs.front().block_height;
}
+#endif
}
std::string wallet2::get_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message)
{
+ return {};
+#if 0
// determine if the address is found in the subaddress hash table (i.e. whether the proof is outbound or inbound)
const bool is_out = m_subaddresses.count(address.m_spend_public_key) == 0;
@@ -9992,10 +10640,13 @@
tools::base58::encode(std::string((const char *)&shared_secret[i], sizeof(crypto::public_key))) +
tools::base58::encode(std::string((const char *)&sig[i], sizeof(crypto::signature)));
return sig_str;
+#endif
}
bool wallet2::check_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received, bool &in_pool, uint64_t &confirmations)
{
+ return {};
+#if 0
const bool is_out = sig_str.substr(0, 3) == "Out";
const std::string header = is_out ? "OutProofV1" : "InProofV1";
const size_t header_len = header.size();
@@ -10108,10 +10759,13 @@
return true;
}
return false;
+#endif
}
std::string wallet2::get_reserve_proof(const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve, const std::string &message)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(m_watch_only || m_multisig, error::wallet_internal_error, "Reserve proof can only be generated by a full wallet");
THROW_WALLET_EXCEPTION_IF(balance_all() == 0, error::wallet_internal_error, "Zero balance");
THROW_WALLET_EXCEPTION_IF(account_minreserve && balance(account_minreserve->first) < account_minreserve->second, error::wallet_internal_error,
@@ -10227,10 +10881,13 @@
boost::archive::portable_binary_oarchive ar(oss);
ar << proofs << subaddr_spendkeys;
return "ReserveProofV1" + tools::base58::encode(oss.str());
+#endif
}
bool wallet2::check_reserve_proof(const cryptonote::account_public_address &address, const std::string &message, const std::string &sig_str, uint64_t &total, uint64_t &spent)
{
+ return {};
+#if 0
uint32_t rpc_version;
THROW_WALLET_EXCEPTION_IF(!check_connection(&rpc_version), error::wallet_internal_error, "Failed to connect to daemon: " + get_daemon_address());
THROW_WALLET_EXCEPTION_IF(rpc_version < MAKE_CORE_RPC_VERSION(1, 0), error::wallet_internal_error, "Daemon RPC version is too old");
@@ -10356,25 +11013,37 @@
return false;
}
return true;
+#endif
}
std::string wallet2::get_wallet_file() const
{
+ return {};
+#if 0
return m_wallet_file;
+#endif
}
std::string wallet2::get_keys_file() const
{
+ return {};
+#if 0
return m_keys_file;
+#endif
}
std::string wallet2::get_daemon_address() const
{
+ return {};
+#if 0
return m_daemon_address;
+#endif
}
uint64_t wallet2::get_daemon_blockchain_height(string &err) const
{
+ return {};
+#if 0
uint64_t height;
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
@@ -10386,19 +11055,25 @@
err = "";
return height;
+#endif
}
uint64_t wallet2::get_daemon_adjusted_time()
{
+ return {};
+#if 0
uint64_t adjusted_time;
boost::optional<std::string> result = m_node_rpc_proxy.get_adjusted_time(adjusted_time);
THROW_WALLET_EXCEPTION_IF(result, error::wallet_internal_error, "Invalid adjusted time from daemon");
return adjusted_time;
+#endif
}
uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
{
+ return {};
+#if 0
err = "";
uint64_t target_height = 0;
const auto result = m_node_rpc_proxy.get_target_height(target_height);
@@ -10408,10 +11083,13 @@
return 0;
}
return target_height;
+#endif
}
uint64_t wallet2::get_approximate_blockchain_height() const
{
+ return {};
+#if 0
// time of v2 fork
const time_t fork_time = m_nettype == TESTNET ? 1521974365 : m_nettype == STAGENET ? 1527139340 : 1438699524;
// v2 fork block
@@ -10422,46 +11100,64 @@
uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block;
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
return approx_blockchain_height;
+#endif
}
void wallet2::set_tx_note(const crypto::hash &txid, const std::string &note)
{
+#if 0
m_tx_notes[txid] = note;
+#endif
}
std::string wallet2::get_tx_note(const crypto::hash &txid) const
{
+ return {};
+#if 0
std::unordered_map<crypto::hash, std::string>::const_iterator i = m_tx_notes.find(txid);
if (i == m_tx_notes.end())
return std::string();
return i->second;
+#endif
}
void wallet2::set_attribute(const std::string &key, const std::string &value)
{
+#if 0
m_attributes[key] = value;
+#endif
}
std::string wallet2::get_attribute(const std::string &key) const
{
+ return {};
+#if 0
std::unordered_map<std::string, std::string>::const_iterator i = m_attributes.find(key);
if (i == m_attributes.end())
return std::string();
return i->second;
+#endif
}
void wallet2::set_description(const std::string &description)
{
+#if 0
set_attribute(ATTRIBUTE_DESCRIPTION, description);
+#endif
}
std::string wallet2::get_description() const
{
+ return {};
+#if 0
return get_attribute(ATTRIBUTE_DESCRIPTION);
+#endif
}
const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& wallet2::get_account_tags()
{
+ return {};
+#if 0
// ensure consistency
if (m_account_tags.second.size() != get_num_subaddress_accounts())
m_account_tags.second.resize(get_num_subaddress_accounts(), "");
@@ -10478,10 +11174,12 @@
++i;
}
return m_account_tags;
+#endif
}
void wallet2::set_account_tag(const std::set<uint32_t> account_indices, const std::string& tag)
{
+#if 0
for (uint32_t account_index : account_indices)
{
THROW_WALLET_EXCEPTION_IF(account_index >= get_num_subaddress_accounts(), error::wallet_internal_error, "Account index out of bound");
@@ -10491,27 +11189,35 @@
m_account_tags.second[account_index] = tag;
}
get_account_tags();
+#endif
}
void wallet2::set_account_tag_description(const std::string& tag, const std::string& description)
{
+#if 0
THROW_WALLET_EXCEPTION_IF(tag.empty(), error::wallet_internal_error, "Tag must not be empty");
THROW_WALLET_EXCEPTION_IF(m_account_tags.first.count(tag) == 0, error::wallet_internal_error, "Tag is unregistered");
m_account_tags.first[tag] = description;
+#endif
}
std::string wallet2::sign(const std::string &data) const
{
+ return {};
+#if 0
crypto::hash hash;
crypto::cn_fast_hash(data.data(), data.size(), hash);
const cryptonote::account_keys &keys = m_account.get_keys();
crypto::signature signature;
crypto::generate_signature(hash, keys.m_account_address.m_spend_public_key, keys.m_spend_secret_key, signature);
return std::string("SigV1") + tools::base58::encode(std::string((const char *)&signature, sizeof(signature)));
+#endif
}
bool wallet2::verify(const std::string &data, const cryptonote::account_public_address &address, const std::string &signature) const
{
+ return {};
+#if 0
const size_t header_len = strlen("SigV1");
if (signature.size() < header_len || signature.substr(0, header_len) != "SigV1") {
LOG_PRINT_L0("Signature header check error");
@@ -10531,10 +11237,13 @@
}
memcpy(&s, decoded.data(), sizeof(s));
return crypto::check_signature(hash, address.m_spend_public_key, s);
+#endif
}
std::string wallet2::sign_multisig_participant(const std::string& data) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
crypto::hash hash;
@@ -10543,10 +11252,13 @@
crypto::signature signature;
crypto::generate_signature(hash, get_multisig_signer_public_key(), keys.m_spend_secret_key, signature);
return MULTISIG_SIGNATURE_MAGIC + tools::base58::encode(std::string((const char *)&signature, sizeof(signature)));
+#endif
}
bool wallet2::verify_with_public_key(const std::string &data, const crypto::public_key &public_key, const std::string &signature) const
{
+ return {};
+#if 0
if (signature.size() < MULTISIG_SIGNATURE_MAGIC.size() || signature.substr(0, MULTISIG_SIGNATURE_MAGIC.size()) != MULTISIG_SIGNATURE_MAGIC) {
MERROR("Signature header check error");
return false;
@@ -10565,10 +11277,13 @@
}
memcpy(&s, decoded.data(), sizeof(s));
return crypto::check_signature(hash, public_key, s);
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const
{
+ return {};
+#if 0
std::vector<tx_extra_field> tx_extra_fields;
if(!parse_tx_extra(td.m_tx.extra, tx_extra_fields))
{
@@ -10623,10 +11338,13 @@
THROW_WALLET_EXCEPTION_IF(true, error::wallet_internal_error,
"Public key yielding at least one output wasn't found in the transaction extra");
return crypto::null_pkey;
+#endif
}
bool wallet2::export_key_images(const std::string &filename) const
{
+ return {};
+#if 0
std::vector<std::pair<crypto::key_image, crypto::signature>> ski = export_key_images();
std::string magic(KEY_IMAGE_EXPORT_FILE_MAGIC, strlen(KEY_IMAGE_EXPORT_FILE_MAGIC));
const cryptonote::account_public_address &keys = get_account().get_keys().m_account_address;
@@ -10643,11 +11361,14 @@
// encrypt data, keep magic plaintext
std::string ciphertext = encrypt_with_view_secret_key(data);
return epee::file_io_utils::save_string_to_file(filename, magic + ciphertext);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<std::pair<crypto::key_image, crypto::signature>> wallet2::export_key_images() const
{
+ return {};
+#if 0
std::vector<std::pair<crypto::key_image, crypto::signature>> ski;
ski.reserve(m_transfers.size());
@@ -10696,10 +11417,13 @@
ski.push_back(std::make_pair(td.m_key_image, signature));
}
return ski;
+#endif
}
uint64_t wallet2::import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent)
{
+ return {};
+#if 0
std::string data;
bool r = epee::file_io_utils::load_file_to_string(filename, data);
@@ -10746,11 +11470,14 @@
}
return import_key_images(ski, spent, unspent);
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::import_key_images(const std::vector<std::pair<crypto::key_image, crypto::signature>> &signed_key_images, uint64_t &spent, uint64_t &unspent, bool check_spent)
{
+ return {};
+#if 0
COMMAND_RPC_IS_KEY_IMAGE_SPENT::request req = AUTO_VAL_INIT(req);
COMMAND_RPC_IS_KEY_IMAGE_SPENT::response daemon_resp = AUTO_VAL_INIT(daemon_resp);
@@ -10984,35 +11711,45 @@
}
return m_transfers[signed_key_images.size() - 1].m_block_height;
+#endif
}
wallet2::payment_container wallet2::export_payments() const
{
+ return {};
+#if 0
payment_container payments;
for (auto const &p : m_payments)
{
payments.emplace(p);
}
return payments;
+#endif
}
void wallet2::import_payments(const payment_container &payments)
{
+#if 0
m_payments.clear();
for (auto const &p : payments)
{
m_payments.emplace(p);
}
+#endif
}
void wallet2::import_payments_out(const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments)
{
+#if 0
m_confirmed_txs.clear();
for (auto const &p : confirmed_payments)
{
m_confirmed_txs.emplace(p);
}
+#endif
}
std::tuple<size_t,crypto::hash,std::vector<crypto::hash>> wallet2::export_blockchain() const
{
+ return {};
+#if 0
std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> bc;
std::get<0>(bc) = m_blockchain.offset();
std::get<1>(bc) = m_blockchain.empty() ? crypto::null_hash: m_blockchain.genesis();
@@ -11021,10 +11758,12 @@
std::get<2>(bc).push_back(m_blockchain[n]);
}
return bc;
+#endif
}
void wallet2::import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc)
{
+#if 0
m_blockchain.clear();
if (std::get<0>(bc))
{
@@ -11041,10 +11780,13 @@
crypto::hash genesis_hash = get_block_hash(genesis);
check_genesis(genesis_hash);
m_last_block_reward = cryptonote::get_outs_money_amount(genesis.miner_tx);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<tools::wallet2::transfer_details> wallet2::export_outputs() const
{
+ return {};
+#if 0
std::vector<tools::wallet2::transfer_details> outs;
outs.reserve(m_transfers.size());
@@ -11056,10 +11798,13 @@
}
return outs;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::export_outputs_to_str() const
{
+ return {};
+#if 0
std::vector<tools::wallet2::transfer_details> outs = export_outputs();
std::stringstream oss;
@@ -11073,10 +11818,13 @@
header += std::string((const char *)&keys.m_view_public_key, sizeof(crypto::public_key));
std::string ciphertext = encrypt_with_view_secret_key(header + oss.str());
return magic + ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
size_t wallet2::import_outputs(const std::vector<tools::wallet2::transfer_details> &outputs)
{
+ return {};
+#if 0
m_transfers.clear();
m_transfers.reserve(outputs.size());
for (size_t i = 0; i < outputs.size(); ++i)
@@ -11107,10 +11855,13 @@
}
return m_transfers.size();
+#endif
}
//----------------------------------------------------------------------------------------------------
size_t wallet2::import_outputs_from_str(const std::string &outputs_st)
{
+ return {};
+#if 0
std::string data = outputs_st;
const size_t magiclen = strlen(OUTPUT_EXPORT_FILE_MAGIC);
if (data.size() < magiclen || memcmp(data.data(), OUTPUT_EXPORT_FILE_MAGIC, magiclen))
@@ -11168,40 +11919,55 @@
}
return imported_outputs;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_multisig_signer_public_key(const crypto::secret_key &spend_skey) const
{
+ return {};
+#if 0
crypto::public_key pkey;
crypto::secret_key_to_public_key(get_multisig_blinded_secret_key(spend_skey), pkey);
return pkey;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_multisig_signer_public_key() const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
crypto::public_key signer;
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(get_account().get_keys().m_spend_secret_key, signer), "Failed to generate signer public key");
return signer;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_multisig_signing_public_key(const crypto::secret_key &msk) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
crypto::public_key pkey;
CHECK_AND_ASSERT_THROW_MES(crypto::secret_key_to_public_key(msk, pkey), "Failed to derive public key");
return pkey;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::public_key wallet2::get_multisig_signing_public_key(size_t idx) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
CHECK_AND_ASSERT_THROW_MES(idx < get_account().get_multisig_keys().size(), "Multisig signing key index out of range");
return get_multisig_signing_public_key(get_account().get_multisig_keys()[idx]);
+#endif
}
//----------------------------------------------------------------------------------------------------
rct::key wallet2::get_multisig_k(size_t idx, const std::unordered_set<rct::key> &used_L) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
CHECK_AND_ASSERT_THROW_MES(idx < m_transfers.size(), "idx out of range");
for (const auto &k: m_transfers[idx].m_multisig_k)
@@ -11213,20 +11979,26 @@
}
THROW_WALLET_EXCEPTION(tools::error::multisig_export_needed);
return rct::zero();
+#endif
}
//----------------------------------------------------------------------------------------------------
rct::multisig_kLRki wallet2::get_multisig_kLRki(size_t n, const rct::key &k) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(n < m_transfers.size(), "Bad m_transfers index");
rct::multisig_kLRki kLRki;
kLRki.k = k;
cryptonote::generate_multisig_LR(m_transfers[n].get_public_key(), rct::rct2sk(kLRki.k), (crypto::public_key&)kLRki.L, (crypto::public_key&)kLRki.R);
kLRki.ki = rct::ki2rct(m_transfers[n].m_key_image);
return kLRki;
+#endif
}
//----------------------------------------------------------------------------------------------------
rct::multisig_kLRki wallet2::get_multisig_composite_kLRki(size_t n, const std::unordered_set<crypto::public_key> &ignore_set, std::unordered_set<rct::key> &used_L, std::unordered_set<rct::key> &new_used_L) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(n < m_transfers.size(), "Bad transfer index");
const transfer_details &td = m_transfers[n];
@@ -11254,10 +12026,13 @@
CHECK_AND_ASSERT_THROW_MES(n_signers_used >= m_multisig_threshold, "LR not found for enough participants");
return kLRki;
+#endif
}
//----------------------------------------------------------------------------------------------------
crypto::key_image wallet2::get_multisig_composite_key_image(size_t n) const
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(n < m_transfers.size(), "Bad output index");
const transfer_details &td = m_transfers[n];
@@ -11271,10 +12046,13 @@
bool r = cryptonote::generate_multisig_composite_key_image(get_account().get_keys(), m_subaddresses, td.get_public_key(), tx_key, additional_tx_keys, td.m_internal_output_index, pkis, ki);
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to generate key image");
return ki;
+#endif
}
//----------------------------------------------------------------------------------------------------
cryptonote::blobdata wallet2::export_multisig()
{
+ return {};
+#if 0
std::vector<tools::wallet2::multisig_info> info;
const crypto::public_key signer = get_multisig_signer_public_key();
@@ -11324,10 +12102,12 @@
std::string ciphertext = encrypt_with_view_secret_key(header + oss.str());
return MULTISIG_EXPORT_FILE_MAGIC + ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::update_multisig_rescan_info(const std::vector<std::vector<rct::key>> &multisig_k, const std::vector<std::vector<tools::wallet2::multisig_info>> &info, size_t n)
{
+#if 0
CHECK_AND_ASSERT_THROW_MES(n < m_transfers.size(), "Bad index in update_multisig_info");
CHECK_AND_ASSERT_THROW_MES(multisig_k.size() >= m_transfers.size(), "Mismatched sizes of multisig_k and info");
@@ -11345,10 +12125,13 @@
td.m_key_image_partial = false;
td.m_multisig_k = multisig_k[n];
m_key_images[td.m_key_image] = n;
+#endif
}
//----------------------------------------------------------------------------------------------------
size_t wallet2::import_multisig(std::vector<cryptonote::blobdata> blobs)
{
+ return {};
+#if 0
CHECK_AND_ASSERT_THROW_MES(m_multisig, "Wallet is not multisig");
std::vector<std::vector<tools::wallet2::multisig_info>> info;
@@ -11459,10 +12242,13 @@
m_multisig_rescan_k = NULL;
return n_outputs;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated) const
{
+ return {};
+#if 0
crypto::chacha_key key;
crypto::generate_chacha_key(&skey, sizeof(skey), key, m_kdf_rounds);
std::string ciphertext;
@@ -11480,31 +12266,46 @@
crypto::generate_signature(hash, pkey, skey, signature);
}
return ciphertext;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::encrypt(const epee::span<char> &plaintext, const crypto::secret_key &skey, bool authenticated) const
{
+ return {};
+#if 0
return encrypt(plaintext.data(), plaintext.size(), skey, authenticated);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::encrypt(const std::string &plaintext, const crypto::secret_key &skey, bool authenticated) const
{
+ return {};
+#if 0
return encrypt(plaintext.data(), plaintext.size(), skey, authenticated);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::encrypt(const epee::wipeable_string &plaintext, const crypto::secret_key &skey, bool authenticated) const
{
+ return {};
+#if 0
return encrypt(plaintext.data(), plaintext.size(), skey, authenticated);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated) const
{
+ return {};
+#if 0
return encrypt(plaintext, get_account().get_keys().m_view_secret_key, authenticated);
+#endif
}
//----------------------------------------------------------------------------------------------------
template<typename T>
T wallet2::decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated) const
{
+ return {};
+#if 0
const size_t prefix_size = sizeof(chacha_iv) + (authenticated ? sizeof(crypto::signature) : 0);
THROW_WALLET_EXCEPTION_IF(ciphertext.size() < prefix_size,
error::wallet_internal_error, "Unexpected ciphertext size");
@@ -11526,17 +12327,23 @@
auto wiper = epee::misc_utils::create_scope_leave_handler([&]() { memwipe(buffer.get(), ciphertext.size() - prefix_size); });
crypto::chacha20(ciphertext.data() + sizeof(iv), ciphertext.size() - prefix_size, key, iv, buffer.get());
return T(buffer.get(), ciphertext.size() - prefix_size);
+#endif
}
//----------------------------------------------------------------------------------------------------
template epee::wipeable_string wallet2::decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated) const;
//----------------------------------------------------------------------------------------------------
std::string wallet2::decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated) const
{
+ return {};
+#if 0
return decrypt(ciphertext, get_account().get_keys().m_view_secret_key, authenticated);
+#endif
}
//----------------------------------------------------------------------------------------------------
std::string wallet2::make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const
{
+ return {};
+#if 0
cryptonote::address_parse_info info;
if(!get_account_address_from_str(info, nettype(), address))
{
@@ -11587,10 +12394,13 @@
}
return uri;
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error)
{
+ return {};
+#if 0
if (uri.substr(0, 5) != "aeon:")
{
error = std::string("URI has wrong scheme (expected \"aeon:\"): ") + uri;
@@ -11671,10 +12481,13 @@
}
}
return true;
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day)
{
+ return {};
+#if 0
uint32_t version;
if (!check_connection(&version))
{
@@ -11758,19 +12571,25 @@
return height_min;
}
}
+#endif
}
//----------------------------------------------------------------------------------------------------
bool wallet2::is_synced() const
{
+ return {};
+#if 0
uint64_t height;
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
if (result && *result != CORE_RPC_STATUS_OK)
return false;
return get_blockchain_current_height() >= height;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<std::pair<uint64_t, uint64_t>> wallet2::estimate_backlog(const std::vector<std::pair<double, double>> &fee_levels)
{
+ return {};
+#if 0
for (const auto &fee_level: fee_levels)
{
THROW_WALLET_EXCEPTION_IF(fee_level.first == 0.0, error::wallet_internal_error, "Invalid 0 fee");
@@ -11821,10 +12640,13 @@
blocks.push_back(std::make_pair(nblocks_min, nblocks_max));
}
return blocks;
+#endif
}
//----------------------------------------------------------------------------------------------------
std::vector<std::pair<uint64_t, uint64_t>> wallet2::estimate_backlog(uint64_t min_tx_weight, uint64_t max_tx_weight, const std::vector<uint64_t> &fees)
{
+ return {};
+#if 0
THROW_WALLET_EXCEPTION_IF(min_tx_weight == 0, error::wallet_internal_error, "Invalid 0 fee");
THROW_WALLET_EXCEPTION_IF(max_tx_weight == 0, error::wallet_internal_error, "Invalid 0 fee");
for (uint64_t fee: fees)
@@ -11838,10 +12660,13 @@
fee_levels.emplace_back(our_fee_byte_min, our_fee_byte_max);
}
return estimate_backlog(fee_levels);
+#endif
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_segregation_fork_height() const
{
+ return {};
+#if 0
if (m_nettype == TESTNET)
return TESTNET_SEGREGATION_FORK_HEIGHT;
if (m_nettype == STAGENET)
@@ -11893,9 +12718,12 @@
}
}
return SEGREGATION_FORK_HEIGHT;
+#endif
}
//----------------------------------------------------------------------------------------------------
void wallet2::generate_genesis(cryptonote::block& b) const {
+#if 0
cryptonote::generate_genesis_block(b, get_config(m_nettype).GENESIS_TX, get_config(m_nettype).GENESIS_NONCE);
+#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment