aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authornaughtyfox <mail.for.milo@gmail.com>2018-12-14 17:42:11 +0300
committernaughtyfox <mail.for.milo@gmail.com>2018-12-14 17:42:11 +0300
commit219548f2998547cc5925380fd7e11842bbdc7ce1 (patch)
tree8559ef8b533d9f1440ad1f7d946ba0d90bf27f12 /src/wallet/wallet2.cpp
parentMerge pull request #4927 (diff)
downloadmonero-219548f2998547cc5925380fd7e11842bbdc7ce1.tar.xz
Sync hashchain bug fixed
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 097278961..62fe4e1a3 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2265,11 +2265,10 @@ void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks
THROW_WALLET_EXCEPTION_IF(prev_blocks.size() != prev_parsed_blocks.size(), error::wallet_internal_error, "size mismatch");
// prepend the last 3 blocks, should be enough to guard against a block or two's reorg
- std::vector<parsed_block>::const_reverse_iterator i = prev_parsed_blocks.rbegin();
- for (size_t n = 0; n < std::min((size_t)3, prev_parsed_blocks.size()); ++n)
+ auto s = std::next(prev_parsed_blocks.rbegin(), std::min((size_t)3, prev_parsed_blocks.size())).base();
+ for (; s != prev_parsed_blocks.end(); ++s)
{
- short_chain_history.push_front(i->hash);
- ++i;
+ short_chain_history.push_front(s->hash);
}
// pull the new blocks