Wallet2: faster exit while refreshing

This commit is contained in:
Jaquee 2016-12-27 19:12:18 +01:00
parent dd580d7bc7
commit 4585ada453
No known key found for this signature in database
GPG Key ID: 384E52B09F45DC39

View File

@ -1613,6 +1613,9 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re
// and then fall through to regular refresh processing // and then fall through to regular refresh processing
} }
// If stop() is called during fast refresh we don't need to continue
if(!m_run.load(std::memory_order_relaxed))
return;
pull_blocks(start_height, blocks_start_height, short_chain_history, blocks, o_indices); pull_blocks(start_height, blocks_start_height, short_chain_history, blocks, o_indices);
// always reset start_height to 0 to force short_chain_ history to be used on // always reset start_height to 0 to force short_chain_ history to be used on
// subsequent pulls in this refresh. // subsequent pulls in this refresh.
@ -1668,6 +1671,8 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re
try try
{ {
// If stop() is called we don't need to check pending transactions
if(m_run.load(std::memory_order_relaxed))
update_pool_state(); update_pool_state();
} }
catch (...) catch (...)