aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-12-14 16:21:55 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-12-14 16:24:04 +0000
commit5cbb17b94681fd0c515c1992fa92505791475571 (patch)
tree52a3df04d23264e2246a9a28ec41addb60a3a4ac
parentMerge pull request #6057 (diff)
downloadmonero-5cbb17b94681fd0c515c1992fa92505791475571.tar.xz
wallet2: fix hang in wallet refresh
If the hashes received would move the current blockchain past the stop point, the short history would not be updated, since we do not expect another loop, but the daemon might return earlier hashes, causing the end index to not be enough to reach the threshold and this require another loop, which will download the same hashes and cause an infinite loop.
-rw-r--r--src/wallet/wallet2.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index ea556ec45..31112bf5d 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -3114,6 +3114,7 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
MERROR("Blocks start before blockchain offset: " << blocks_start_height << " " << m_blockchain.offset());
return;
}
+ current_index = blocks_start_height;
if (hashes.size() + current_index < stop_height) {
drop_from_short_history(short_chain_history, 3);
std::vector<crypto::hash>::iterator right = hashes.end();
@@ -3123,7 +3124,6 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
short_chain_history.push_front(*right);
}
}
- current_index = blocks_start_height;
for(auto& bl_id: hashes)
{
if(current_index >= m_blockchain.size())