wallet2: fix accessing unwound stack on exception

This commit is contained in:
moneromooo-monero 2018-12-16 18:27:11 +00:00
parent 6bc0c7e685
commit 841a6acda2
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 12 additions and 4 deletions

View File

@ -2744,13 +2744,16 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
bool first = true; bool first = true;
while(m_run.load(std::memory_order_relaxed)) while(m_run.load(std::memory_order_relaxed))
{ {
uint64_t next_blocks_start_height;
std::vector<cryptonote::block_complete_entry> next_blocks;
std::vector<parsed_block> next_parsed_blocks;
bool error;
try try
{ {
// pull the next set of blocks while we're processing the current one // pull the next set of blocks while we're processing the current one
uint64_t next_blocks_start_height; error = false;
std::vector<cryptonote::block_complete_entry> next_blocks; next_blocks.clear();
std::vector<parsed_block> next_parsed_blocks; next_parsed_blocks.clear();
bool error = false;
added_blocks = 0; added_blocks = 0;
if (!first && blocks.empty()) if (!first && blocks.empty())
{ {
@ -2788,6 +2791,11 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
start_height = stop_height; start_height = stop_height;
throw std::runtime_error(""); // loop again throw std::runtime_error(""); // loop again
} }
catch (const std::exception &e)
{
MERROR("Error parsing blocks: " << e.what());
error = true;
}
blocks_fetched += added_blocks; blocks_fetched += added_blocks;
} }
waiter.wait(&tpool); waiter.wait(&tpool);