aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-10-21 18:31:30 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-17 16:12:30 +0000
commita36c261d7adc9bef61730a581fe92c0edc72ddce (patch)
treef633d2f295f589a863acd1f087a730211ad4285b /src
parentmake multisig work with subaddresses (diff)
downloadmonero-a36c261d7adc9bef61730a581fe92c0edc72ddce.tar.xz
wallet2: fix slow multisig unit tests with subaddress patch
While there, move the wallet2 ctor to the cpp file as it's a huge amount of init list now, and remove an unused one.
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp47
-rw-r--r--src/wallet/wallet2.h8
2 files changed, 47 insertions, 8 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 4ad6d852d..013ad6a75 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -573,6 +573,41 @@ const size_t MAX_SPLIT_ATTEMPTS = 30;
constexpr const std::chrono::seconds wallet2::rpc_timeout;
const char* wallet2::tr(const char* str) { return i18n_translate(str, "tools::wallet2"); }
+wallet2::wallet2(bool testnet, bool restricted):
+ m_multisig_rescan_info(NULL),
+ m_multisig_rescan_k(NULL),
+ m_run(true),
+ m_callback(0),
+ m_testnet(testnet),
+ m_always_confirm_transfers(true),
+ m_print_ring_members(false),
+ m_store_tx_info(true),
+ m_default_mixin(0),
+ m_default_priority(0),
+ m_refresh_type(RefreshOptimizeCoinbase),
+ m_auto_refresh(true),
+ m_refresh_from_block_height(0),
+ m_confirm_missing_payment_id(true),
+ m_ask_password(true),
+ m_min_output_count(0),
+ m_min_output_value(0),
+ m_merge_destinations(false),
+ m_confirm_backlog(true),
+ m_is_initialized(false),
+ m_restricted(restricted),
+ is_old_file_format(false),
+ m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex),
+ m_subaddress_lookahead_major(SUBADDRESS_LOOKAHEAD_MAJOR),
+ m_subaddress_lookahead_minor(SUBADDRESS_LOOKAHEAD_MINOR),
+ m_light_wallet(false),
+ m_light_wallet_scanned_block_height(0),
+ m_light_wallet_blockchain_height(0),
+ m_light_wallet_connected(false),
+ m_light_wallet_balance(0),
+ m_light_wallet_unlocked_balance(0)
+{
+}
+
bool wallet2::has_testnet_option(const boost::program_options::variables_map& vm)
{
return command_line::get_arg(vm, options().testnet);
@@ -764,9 +799,9 @@ void wallet2::expand_subaddresses(const cryptonote::subaddress_index& index)
{
// add new accounts
cryptonote::subaddress_index index2;
- for (index2.major = m_subaddress_labels.size(); index2.major < index.major + SUBADDRESS_LOOKAHEAD_MAJOR; ++index2.major)
+ for (index2.major = m_subaddress_labels.size(); index2.major < index.major + m_subaddress_lookahead_major; ++index2.major)
{
- for (index2.minor = 0; index2.minor < (index2.major == index.major ? index.minor : 0) + SUBADDRESS_LOOKAHEAD_MINOR; ++index2.minor)
+ for (index2.minor = 0; index2.minor < (index2.major == index.major ? index.minor : 0) + m_subaddress_lookahead_minor; ++index2.minor)
{
if (m_subaddresses_inv.count(index2) == 0)
{
@@ -783,7 +818,7 @@ void wallet2::expand_subaddresses(const cryptonote::subaddress_index& index)
{
// add new subaddresses
cryptonote::subaddress_index index2 = index;
- for (index2.minor = m_subaddress_labels[index.major].size(); index2.minor < index.minor + SUBADDRESS_LOOKAHEAD_MINOR; ++index2.minor)
+ for (index2.minor = m_subaddress_labels[index.major].size(); index2.minor < index.minor + m_subaddress_lookahead_minor; ++index2.minor)
{
if (m_subaddresses_inv.count(index2) == 0)
{
@@ -813,6 +848,12 @@ void wallet2::set_subaddress_label(const cryptonote::subaddress_index& index, co
m_subaddress_labels[index.major][index.minor] = label;
}
//----------------------------------------------------------------------------------------------------
+void wallet2::set_subaddress_lookahead(size_t major, size_t minor)
+{
+ m_subaddress_lookahead_major = major;
+ m_subaddress_lookahead_minor = minor;
+}
+//----------------------------------------------------------------------------------------------------
/*!
* \brief Tells if the wallet file is deprecated.
*/
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 45f82fa1a..83a4fd2e1 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -144,10 +144,6 @@ namespace tools
RefreshDefault = RefreshOptimizeCoinbase,
};
- private:
- wallet2(const wallet2&) : m_multisig_rescan_info(NULL), m_multisig_rescan_k(NULL), m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshDefault), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_ask_password(true), m_min_output_count(0), m_min_output_value(0), m_merge_destinations(false), m_confirm_backlog(true), m_is_initialized(false),m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {}
-
- public:
static const char* tr(const char* str);
static bool has_testnet_option(const boost::program_options::variables_map& vm);
@@ -168,7 +164,7 @@ namespace tools
static bool verify_password(const std::string& keys_file_name, const epee::wipeable_string& password, bool no_spend_key);
- wallet2(bool testnet = false, bool restricted = false) : m_multisig_rescan_info(NULL), m_multisig_rescan_k(NULL), m_run(true), m_callback(0), m_testnet(testnet), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshDefault), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_ask_password(true), m_min_output_count(0), m_min_output_value(0), m_merge_destinations(false), m_confirm_backlog(true), m_is_initialized(false), m_restricted(restricted), is_old_file_format(false), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex), m_light_wallet(false), m_light_wallet_scanned_block_height(0), m_light_wallet_blockchain_height(0), m_light_wallet_connected(false), m_light_wallet_balance(0), m_light_wallet_unlocked_balance(0) {}
+ wallet2(bool testnet = false, bool restricted = false);
struct multisig_info
{
@@ -583,6 +579,7 @@ namespace tools
void expand_subaddresses(const cryptonote::subaddress_index& index);
std::string get_subaddress_label(const cryptonote::subaddress_index& index) const;
void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label);
+ void set_subaddress_lookahead(size_t major, size_t minor);
/*!
* \brief Tells if the wallet file is deprecated.
*/
@@ -1049,6 +1046,7 @@ namespace tools
bool m_is_initialized;
NodeRPCProxy m_node_rpc_proxy;
std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
+ size_t m_subaddress_lookahead_major, m_subaddress_lookahead_minor;
// Light wallet
bool m_light_wallet; /* sends view key to daemon for scanning */