diff options
author | tobtoht <thotbot@protonmail.com> | 2021-06-04 18:37:06 +0200 |
---|---|---|
committer | tobtoht <thotbot@protonmail.com> | 2021-06-04 18:37:06 +0200 |
commit | 8cf95c8f2926fa85c232596d06f17633e7007cd1 (patch) | |
tree | 0e54eb6ec9060c595f7b0271950cadc06e5872b6 /src/wallet/wallet2.cpp | |
parent | Merge pull request #7735 (diff) | |
download | monero-8cf95c8f2926fa85c232596d06f17633e7007cd1.tar.xz |
wallet2: refresh: check error and throw before potentially breaking out of loop
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 0b310111e..7446df111 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3491,14 +3491,6 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo blocks_fetched += added_blocks; } THROW_WALLET_EXCEPTION_IF(!waiter.wait(), error::wallet_internal_error, "Exception in thread pool"); - if(!first && blocks_start_height == next_blocks_start_height) - { - m_node_rpc_proxy.set_height(m_blockchain.size()); - refreshed = true; - break; - } - - first = false; // handle error from async fetching thread if (error) @@ -3509,6 +3501,15 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo throw std::runtime_error("proxy exception in refresh thread"); } + if(!first && blocks_start_height == next_blocks_start_height) + { + m_node_rpc_proxy.set_height(m_blockchain.size()); + refreshed = true; + break; + } + + first = false; + if (!next_blocks.empty()) { const uint64_t expected_start_height = std::max(static_cast<uint64_t>(m_blockchain.size()), uint64_t(1)) - 1; |