From d86ae2bec6737ca1c1f85b3a8395a4a241659a72 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 7 Jan 2017 16:06:07 +0000 Subject: wallet2: reuse fake outs when adjusting fee on transfer This avoids indirectly leaking the real output to the daemon, and is faster. This will still happen for more complex cases, especially when cancelling a tx and "re-rolling" it. --- src/wallet/wallet2.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index b5cc56e56..b0aec681f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -275,6 +275,8 @@ namespace tools std::string m_description; }; + typedef std::tuple get_outs_entry; + /*! * \brief Generates a wallet or restores one. * \param wallet_ Name of wallet file @@ -387,8 +389,10 @@ namespace tools void transfer(const std::vector& dsts, const size_t fake_outputs_count, const std::vector &unused_transfers_indices, uint64_t unlock_time, uint64_t fee, const std::vector& extra, cryptonote::transaction& tx, pending_tx& ptx, bool trusted_daemon); template void transfer_selected(const std::vector& dsts, const std::list selected_transfers, size_t fake_outputs_count, + std::vector> &outs, uint64_t unlock_time, uint64_t fee, const std::vector& extra, T destination_split_strategy, const tx_dust_policy& dust_policy, cryptonote::transaction& tx, pending_tx &ptx); void transfer_selected_rct(std::vector dsts, const std::list selected_transfers, size_t fake_outputs_count, + std::vector> &outs, uint64_t unlock_time, uint64_t fee, const std::vector& extra, cryptonote::transaction& tx, pending_tx &ptx); void commit_tx(pending_tx& ptx_vector); @@ -607,8 +611,7 @@ namespace tools std::vector pick_preferred_rct_inputs(uint64_t needed_money) const; void set_spent(size_t idx, uint64_t height); void set_unspent(size_t idx); - template - void get_outs(std::vector> &outs, const std::list &selected_transfers, size_t fake_outputs_count); + void get_outs(std::vector> &outs, const std::list &selected_transfers, size_t fake_outputs_count); bool wallet_generate_key_image_helper(const cryptonote::account_keys& ack, const crypto::public_key& tx_public_key, size_t real_output_index, cryptonote::keypair& in_ephemeral, crypto::key_image& ki); crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const; -- cgit v1.2.3 From 693c1908815d8574a1125288f0400eab5f5085a7 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 7 Jan 2017 19:23:57 +0000 Subject: wallet: add a node RPC cache layer for simple RPC calls Mostly getinfo and get_hard_fork_info, which are called pretty often. This speeds up transfers as a bonus. --- src/wallet/wallet2.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index b0aec681f..629011800 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -54,6 +54,7 @@ #include "wallet_errors.h" #include "password_container.h" +#include "node_rpc_proxy.h" #include @@ -103,7 +104,7 @@ namespace tools }; private: - wallet2(const wallet2&) : 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(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true) {} + wallet2(const wallet2&) : 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(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {} public: static const char* tr(const char* str);// { return i18n_translate(str, "cryptonote::simple_wallet"); } @@ -124,7 +125,7 @@ namespace tools //! Uses stdin and stdout. Returns a wallet2 and password for wallet with no file if no errors. static std::pair, password_container> make_new(const boost::program_options::variables_map& vm); - wallet2(bool testnet = false, bool restricted = false) : 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_restricted(restricted), is_old_file_format(false) {} + wallet2(bool testnet = false, bool restricted = false) : 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_restricted(restricted), is_old_file_format(false), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {} struct transfer_details { uint64_t m_block_height; @@ -655,6 +656,7 @@ namespace tools bool m_auto_refresh; uint64_t m_refresh_from_block_height; bool m_confirm_missing_payment_id; + NodeRPCProxy m_node_rpc_proxy; }; } BOOST_CLASS_VERSION(tools::wallet2, 16) -- cgit v1.2.3