Merge pull request #3450

3b941be core: add get_earliest_ideal_height_for_version() (stoffu)
This commit is contained in:
luigi1111 2018-06-08 14:31:49 -05:00
commit 22c8730261
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
5 changed files with 21 additions and 0 deletions

View File

@ -794,6 +794,13 @@ namespace cryptonote
*/ */
uint8_t get_hard_fork_version(uint64_t height) const { return m_hardfork->get(height); } uint8_t get_hard_fork_version(uint64_t height) const { return m_hardfork->get(height); }
/**
* @brief returns the earliest block a given version may activate
*
* @return the height
*/
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const { return m_hardfork->get_earliest_ideal_height_for_version(version); }
/** /**
* @brief get information about hardfork voting for a version * @brief get information about hardfork voting for a version
* *

View File

@ -1401,6 +1401,11 @@ namespace cryptonote
return get_blockchain_storage().get_hard_fork_version(height); return get_blockchain_storage().get_hard_fork_version(height);
} }
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
uint64_t core::get_earliest_ideal_height_for_version(uint8_t version) const
{
return get_blockchain_storage().get_earliest_ideal_height_for_version(version);
}
//-----------------------------------------------------------------------------------------------
bool core::check_updates() bool core::check_updates()
{ {
static const char software[] = "monero"; static const char software[] = "monero";

View File

@ -662,6 +662,13 @@ namespace cryptonote
*/ */
uint8_t get_hard_fork_version(uint64_t height) const; uint8_t get_hard_fork_version(uint64_t height) const;
/**
* @brief return the earliest block a given version may activate
*
* @return what it says above
*/
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const;
/** /**
* @brief gets start_time * @brief gets start_time
* *

View File

@ -100,6 +100,7 @@ namespace tests
uint8_t get_ideal_hard_fork_version() const { return 0; } uint8_t get_ideal_hard_fork_version() const { return 0; }
uint8_t get_ideal_hard_fork_version(uint64_t height) const { return 0; } uint8_t get_ideal_hard_fork_version(uint64_t height) const { return 0; }
uint8_t get_hard_fork_version(uint64_t height) const { return 0; } uint8_t get_hard_fork_version(uint64_t height) const { return 0; }
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const { return 0; }
cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; } cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; }
bool fluffy_blocks_enabled() const { return false; } bool fluffy_blocks_enabled() const { return false; }
uint64_t prevalidate_block_hashes(uint64_t height, const std::list<crypto::hash> &hashes) { return 0; } uint64_t prevalidate_block_hashes(uint64_t height, const std::list<crypto::hash> &hashes) { return 0; }

View File

@ -79,6 +79,7 @@ public:
uint8_t get_ideal_hard_fork_version() const { return 0; } uint8_t get_ideal_hard_fork_version() const { return 0; }
uint8_t get_ideal_hard_fork_version(uint64_t height) const { return 0; } uint8_t get_ideal_hard_fork_version(uint64_t height) const { return 0; }
uint8_t get_hard_fork_version(uint64_t height) const { return 0; } uint8_t get_hard_fork_version(uint64_t height) const { return 0; }
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const { return 0; }
cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; } cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; }
bool fluffy_blocks_enabled() const { return false; } bool fluffy_blocks_enabled() const { return false; }
uint64_t prevalidate_block_hashes(uint64_t height, const std::list<crypto::hash> &hashes) { return 0; } uint64_t prevalidate_block_hashes(uint64_t height, const std::list<crypto::hash> &hashes) { return 0; }