diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-27 17:25:15 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-27 17:25:15 +0000 |
commit | 490590306efdd60a4663967c1c0a95d4acb4b886 (patch) | |
tree | 9609516b8c7974b1741c2435299907e1645c91c5 /src/wallet/wallet2.h | |
parent | wallet2: maintain the short chain manually when refreshing (diff) | |
download | monero-490590306efdd60a4663967c1c0a95d4acb4b886.tar.xz |
wallet2: parallelize pulling blocks and processing them on refresh
This needed locking the use of m_http_client, to avoid collisions
in I/O.
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index c1365f276..b71697c1f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -356,6 +356,7 @@ namespace tools bool is_transfer_unlocked(const transfer_details& td) const; bool clear(); void pull_blocks(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::list<cryptonote::block_complete_entry> &blocks); + void pull_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::list<cryptonote::block_complete_entry> &prev_blocks, std::list<cryptonote::block_complete_entry> &blocks); void process_blocks(uint64_t start_height, const std::list<cryptonote::block_complete_entry> &blocks, uint64_t& blocks_added); uint64_t select_transfers(uint64_t needed_money, bool add_dust, uint64_t dust, std::list<transfer_container::iterator>& selected_transfers); bool prepare_file_names(const std::string& file_path); @@ -388,6 +389,8 @@ namespace tools std::atomic<bool> m_run; + std::mutex m_daemon_rpc_mutex; + i_wallet2_callback* m_callback; bool m_testnet; bool m_restricted; @@ -564,7 +567,9 @@ namespace tools req.amounts.push_back(it->amount()); } + m_daemon_rpc_mutex.lock(); bool r = epee::net_utils::invoke_http_bin_remote_command2(m_daemon_address + "/getrandom_outs.bin", req, daemon_resp, m_http_client, 200000); + m_daemon_rpc_mutex.unlock(); THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "getrandom_outs.bin"); THROW_WALLET_EXCEPTION_IF(daemon_resp.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "getrandom_outs.bin"); THROW_WALLET_EXCEPTION_IF(daemon_resp.status != CORE_RPC_STATUS_OK, error::get_random_outs_error, daemon_resp.status); |