aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-24 22:37:15 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-24 22:37:16 +0200
commiteb1da46ac198aed18bc70129c8cf6c80cf45fcf6 (patch)
tree5326c0ecccde02dab44d0712ed132df71b380e38 /src
parentMerge pull request #5466 (diff)
parentfunctional_tests: reset blockchain on test start (diff)
downloadmonero-eb1da46ac198aed18bc70129c8cf6c80cf45fcf6.tar.xz
Merge pull request #5467
aba2b2e7 functional_tests: reset blockchain on test start (moneromooo-monero) 375fde94 hardfork: fix off by one updating fork index after popping (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_basic/hardfork.cpp5
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;
}