mirror of
https://github.com/monero-project/monero.git
synced 2025-07-23 06:00:42 -04:00
hardfork: add a get_ideal_version(uint64_t) function
It returns the ideal version for a given height, which is based on the minimum height for a fork, disregarding votes
This commit is contained in:
parent
4187e569d8
commit
2f254ff599
3 changed files with 40 additions and 0 deletions
|
@ -337,6 +337,17 @@ uint8_t HardFork::get_ideal_version() const
|
|||
return heights.back().version;
|
||||
}
|
||||
|
||||
uint8_t HardFork::get_ideal_version(uint64_t height) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(lock);
|
||||
for (unsigned int n = heights.size() - 1; n > 0; --n) {
|
||||
if (height >= heights[n].height) {
|
||||
return heights[n].version;
|
||||
}
|
||||
}
|
||||
return original_version;
|
||||
}
|
||||
|
||||
bool HardFork::get_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint8_t &voting) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(lock);
|
||||
|
|
|
@ -167,6 +167,13 @@ namespace cryptonote
|
|||
*/
|
||||
uint8_t get_ideal_version() const;
|
||||
|
||||
/**
|
||||
* @brief returns the "ideal" version for a given height
|
||||
*
|
||||
* @param height height of the block to check
|
||||
*/
|
||||
uint8_t get_ideal_version(uint64_t height) const;
|
||||
|
||||
/**
|
||||
* @brief returns the current version
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue