diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-19 23:55:04 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-20 00:05:35 +0000 |
commit | 375fde9454a2730dda5ea589587d7786669fd11b (patch) | |
tree | 22991455f76394c1720c2ba5684012bd0c946fa7 /src/cryptonote_basic/hardfork.cpp | |
parent | Merge pull request #5465 (diff) | |
download | monero-375fde9454a2730dda5ea589587d7786669fd11b.tar.xz |
hardfork: fix off by one updating fork index after popping
Diffstat (limited to 'src/cryptonote_basic/hardfork.cpp')
-rw-r--r-- | src/cryptonote_basic/hardfork.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cryptonote_basic/hardfork.cpp b/src/cryptonote_basic/hardfork.cpp index d5710f727..98158a513 100644 --- a/src/cryptonote_basic/hardfork.cpp +++ b/src/cryptonote_basic/hardfork.cpp @@ -292,8 +292,7 @@ void HardFork::on_block_popped(uint64_t nblocks) const uint64_t new_chain_height = db.height(); const uint64_t old_chain_height = new_chain_height + nblocks; uint8_t version; - uint64_t height; - for (height = old_chain_height - 1; height >= new_chain_height; --height) + for (uint64_t height = old_chain_height - 1; height >= new_chain_height; --height) { version = versions.back(); last_versions[version]--; @@ -305,7 +304,7 @@ void HardFork::on_block_popped(uint64_t nblocks) // does not take voting into account for (current_fork_index = heights.size() - 1; current_fork_index > 0; --current_fork_index) - if (height >= heights[current_fork_index].height) + if (new_chain_height >= heights[current_fork_index].height) break; } |