mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #4980
219548f2
Sync hashchain bug fixed (naughtyfox)
This commit is contained in:
commit
a193f1e236
1 changed files with 3 additions and 4 deletions
|
@ -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");
|
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
|
// 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();
|
auto s = std::next(prev_parsed_blocks.rbegin(), std::min((size_t)3, prev_parsed_blocks.size())).base();
|
||||||
for (size_t n = 0; n < std::min((size_t)3, prev_parsed_blocks.size()); ++n)
|
for (; s != prev_parsed_blocks.end(); ++s)
|
||||||
{
|
{
|
||||||
short_chain_history.push_front(i->hash);
|
short_chain_history.push_front(s->hash);
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pull the new blocks
|
// pull the new blocks
|
||||||
|
|
Loading…
Reference in a new issue