wallet2: fix infinite loop on future refresh height

If the refresh height is in the future, the current code will
loop till the actual height reaches this. Fix it by bailing out
if we receive only three hashes, which is what we set in the
call parameters.
This commit is contained in:
moneromooo-monero 2017-06-26 06:56:44 +01:00
parent 32754784db
commit d3bb72fff1
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -1601,7 +1601,7 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
while(m_run.load(std::memory_order_relaxed) && 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); pull_hashes(0, blocks_start_height, short_chain_history, hashes);
if (hashes.size() < 3) if (hashes.size() <= 3)
return; return;
if (hashes.size() + current_index < stop_height) { if (hashes.size() + current_index < stop_height) {
std::list<crypto::hash>::iterator right; std::list<crypto::hash>::iterator right;