mirror of
https://github.com/monero-project/monero.git
synced 2025-08-01 00:58:42 -04:00
hardfork: fix get_earliest_ideal_height_for_version() to support non-existent versions
This commit is contained in:
parent
c534fe8d19
commit
a79fc219b7
2 changed files with 33 additions and 4 deletions
|
@ -379,11 +379,15 @@ uint8_t HardFork::get_ideal_version(uint64_t height) const
|
|||
|
||||
uint64_t HardFork::get_earliest_ideal_height_for_version(uint8_t version) const
|
||||
{
|
||||
for (unsigned int n = heights.size() - 1; n > 0; --n) {
|
||||
if (heights[n].version <= version)
|
||||
return heights[n].height;
|
||||
uint64_t height = std::numeric_limits<uint64_t>::max();
|
||||
for (auto i = heights.rbegin(); i != heights.rend(); ++i) {
|
||||
if (i->version >= version) {
|
||||
height = i->height;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return height;
|
||||
}
|
||||
|
||||
uint8_t HardFork::get_next_version() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue