diff options
author | Howard Chu <hyc@symas.com> | 2016-04-29 06:21:08 +0100 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2016-04-29 15:33:28 +0100 |
commit | 590c43988c1c69ea046cefd8125aae00cc2cccca (patch) | |
tree | 105f2d83b599246b1ef60bb07f3381f30f863d08 /src | |
parent | Set refresh height earlier (diff) | |
download | monero-590c43988c1c69ea046cefd8125aae00cc2cccca.tar.xz |
Make fast_refresh interruptible
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet2.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 53ce23490..1656089c8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -796,7 +796,8 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, { std::list<crypto::hash> hashes; size_t current_index = m_blockchain.size(); - while(current_index < stop_height) + + while(m_run.load(std::memory_order_relaxed) && current_index < stop_height) { pull_hashes(0, blocks_start_height, short_chain_history, hashes); if (hashes.size() < 3) @@ -860,6 +861,7 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re // pull the first set of blocks get_short_chain_history(short_chain_history); + m_run.store(true, std::memory_order_relaxed); if (start_height > m_blockchain.size() || m_refresh_from_block_height > m_blockchain.size()) { if (!start_height) start_height = m_refresh_from_block_height; @@ -877,7 +879,6 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re // subsequent pulls in this refresh. start_height = 0; - m_run.store(true, std::memory_order_relaxed); while(m_run.load(std::memory_order_relaxed)) { try |