hardfork: fix fork determination for historical heights

This commit is contained in:
moneromooo 2019-02-27 15:56:49 +00:00 committed by moneromooo-monero
parent 5941a47819
commit 8f0318d790
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 1 additions and 1 deletions

View File

@ -332,7 +332,7 @@ int HardFork::get_voted_fork_index(uint64_t height) const
{ {
CRITICAL_REGION_LOCAL(lock); CRITICAL_REGION_LOCAL(lock);
uint32_t accumulated_votes = 0; uint32_t accumulated_votes = 0;
for (unsigned int n = heights.size() - 1; n > current_fork_index; --n) { for (int n = heights.size() - 1; n >= 0; --n) {
uint8_t v = heights[n].version; uint8_t v = heights[n].version;
accumulated_votes += last_versions[v]; accumulated_votes += last_versions[v];
uint32_t threshold = (window_size * heights[n].threshold + 99) / 100; uint32_t threshold = (window_size * heights[n].threshold + 99) / 100;