Merge pull request #5224

807903bb hardfork: fix fork determination for historical heights (moneromooo)
This commit is contained in:
Riccardo Spagni 2019-03-04 17:17:34 +02:00
commit 9547e3f451
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -332,7 +332,7 @@ int HardFork::get_voted_fork_index(uint64_t height) const
{
CRITICAL_REGION_LOCAL(lock);
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;
accumulated_votes += last_versions[v];
uint32_t threshold = (window_size * heights[n].threshold + 99) / 100;