aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-01-16 19:05:09 +0200
committerRiccardo Spagni <ric@spagni.net>2019-01-16 19:05:09 +0200
commita193f1e2366406ea11549892cd71cd3e6b9d78aa (patch)
treeffa3f431219714a1b3a18b8575c8ff7bfa14cc1e
parentMerge pull request #4979 (diff)
parentSync hashchain bug fixed (diff)
downloadmonero-a193f1e2366406ea11549892cd71cd3e6b9d78aa.tar.xz
Merge pull request #4980
219548f2 Sync hashchain bug fixed (naughtyfox)
-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 eb61098c2..31261bead 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2307,11 +2307,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