mirror of
https://github.com/monero-project/monero.git
synced 2025-08-01 01:08:47 -04:00
hardfork: fix get_next_version()
This commit is contained in:
parent
7e30eadb32
commit
98cf62cc45
2 changed files with 32 additions and 3 deletions
|
@ -394,9 +394,9 @@ uint8_t HardFork::get_next_version() const
|
|||
{
|
||||
CRITICAL_REGION_LOCAL(lock);
|
||||
uint64_t height = db.height();
|
||||
for (unsigned int n = heights.size() - 1; n > 0; --n) {
|
||||
if (height >= heights[n].height) {
|
||||
return heights[n < heights.size() - 1 ? n + 1 : n].version;
|
||||
for (auto i = heights.rbegin(); i != heights.rend(); ++i) {
|
||||
if (height >= i->height) {
|
||||
return (i == heights.rbegin() ? i : (i - 1))->version;
|
||||
}
|
||||
}
|
||||
return original_version;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue