Sync hashchain bug fixed

release-v0.5.0
naughtyfox 6 years ago committed by wowario
parent 35d09f896b
commit 0acdc0fe0c
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111

@ -2310,11 +2310,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

Loading…
Cancel
Save