forked from lthn/blockchain
runtime config: min build number introduced and tied to hardfork
This commit is contained in:
parent
8758f6dc79
commit
b77419afc7
2 changed files with 21 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2014-2020 Zano Project
|
||||
// Copyright (c) 2014-2024 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Copyright (c) 2012-2013 The Boolberry developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
|
|
@ -109,10 +109,16 @@ namespace currency
|
|||
wide_difficulty_type max_pos_difficulty;
|
||||
|
||||
hard_forks_descriptor hard_forks;
|
||||
std::array<int, ZANO_HARDFORKS_TOTAL> min_build_numbers_for_hard_forks;
|
||||
|
||||
bool is_hardfork_active_for_height(size_t hardfork_id, uint64_t height) const
|
||||
bool is_hardfork_active_for_height(size_t hardfork_id, uint64_t upcoming_block_height) const
|
||||
{
|
||||
return hard_forks.is_hardfork_active_for_height(hardfork_id, height);
|
||||
return hard_forks.is_hardfork_active_for_height(hardfork_id, upcoming_block_height);
|
||||
}
|
||||
|
||||
int get_min_allowed_build_version_for_height(uint64_t upcoming_block_height) const
|
||||
{
|
||||
return min_build_numbers_for_hard_forks[hard_forks.get_the_most_recent_hardfork_id_for_height(upcoming_block_height)];
|
||||
}
|
||||
|
||||
static uint64_t _default_core_time_function()
|
||||
|
|
@ -123,7 +129,7 @@ namespace currency
|
|||
|
||||
inline core_runtime_config get_default_core_runtime_config()
|
||||
{
|
||||
core_runtime_config pc = AUTO_VAL_INIT(pc);
|
||||
core_runtime_config pc{};
|
||||
pc.min_coinstake_age = POS_MINIMUM_COINSTAKE_AGE;
|
||||
pc.pos_minimum_heigh = POS_START_HEIGHT;
|
||||
pc.tx_pool_min_fee = TX_MINIMUM_FEE;
|
||||
|
|
@ -137,7 +143,9 @@ namespace currency
|
|||
pc.hard_forks.set_hardfork_height(2, ZANO_HARDFORK_02_AFTER_HEIGHT);
|
||||
pc.hard_forks.set_hardfork_height(3, ZANO_HARDFORK_03_AFTER_HEIGHT);
|
||||
pc.hard_forks.set_hardfork_height(4, ZANO_HARDFORK_04_AFTER_HEIGHT);
|
||||
|
||||
pc.hard_forks.set_hardfork_height(5, ZANO_HARDFORK_05_AFTER_HEIGHT); pc.min_build_numbers_for_hard_forks[5] = ZANO_HARDFORK_05_MIN_BUILD_VER;
|
||||
static_assert(5 + 1 == ZANO_HARDFORKS_TOTAL);
|
||||
|
||||
pc.get_core_time = &core_runtime_config::_default_core_time_function;
|
||||
bool r = epee::string_tools::hex_to_pod(ALIAS_SHORT_NAMES_VALIDATION_PUB_KEY, pc.alias_validation_pubkey);
|
||||
CHECK_AND_ASSERT_THROW_MES(r, "failed to parse alias_validation_pub_key");
|
||||
|
|
|
|||
|
|
@ -258,25 +258,29 @@
|
|||
|
||||
#define CURRENT_MEMPOOL_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+31)
|
||||
|
||||
//hard forks section
|
||||
#define BLOCK_MAJOR_VERSION_GENESIS 1
|
||||
#define BLOCK_MINOR_VERSION_GENESIS 0
|
||||
#define BLOCK_MAJOR_VERSION_INITIAL 0
|
||||
|
||||
/////// Hard forks setup //////////////////////////////
|
||||
#ifndef TESTNET
|
||||
// Mainnet
|
||||
#define ZANO_HARDFORK_01_AFTER_HEIGHT 194624 // 2019-09-21 20:25:16
|
||||
#define ZANO_HARDFORK_02_AFTER_HEIGHT 999999 // 2021-04-05 09:11:45
|
||||
#define ZANO_HARDFORK_03_AFTER_HEIGHT 1082577 // 2021-06-01 23:28:10
|
||||
#define ZANO_HARDFORK_04_AFTER_HEIGHT 2555000 // 2024-03-21 11:49:55
|
||||
#define ZANO_HARDFORK_05_AFTER_HEIGHT 999999999999999999
|
||||
#define ZANO_HARDFORK_04_TIMESTAMP_ACTUAL 1711021795ull // block 2555000, 2024-03-21 11:49:55 UTC
|
||||
#define ZANO_HARDFORK_05_AFTER_HEIGHT 999999999999999999
|
||||
#define ZANO_HARDFORK_05_MIN_BUILD_VER 0
|
||||
#else
|
||||
/////// Zarcanum Testnet //////////////////////////////
|
||||
// Testnet
|
||||
#define ZANO_HARDFORK_01_AFTER_HEIGHT 0
|
||||
#define ZANO_HARDFORK_02_AFTER_HEIGHT 0
|
||||
#define ZANO_HARDFORK_03_AFTER_HEIGHT 0
|
||||
#define ZANO_HARDFORK_04_AFTER_HEIGHT 200
|
||||
#define ZANO_HARDFORK_05_AFTER_HEIGHT 200
|
||||
#define ZANO_HARDFORK_04_TIMESTAMP_ACTUAL 1712785801ull // block 200, 2024-04-10 21:50:01 UTC
|
||||
#define ZANO_HARDFORK_05_AFTER_HEIGHT 241400
|
||||
#define ZANO_HARDFORK_05_MIN_BUILD_VER 342
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue