forked from lthn/blockchain
pre hardfork tx freeze period implemented (+HF6)
This commit is contained in:
parent
2006b71250
commit
4c860417f5
5 changed files with 37 additions and 3 deletions
|
|
@ -1029,7 +1029,24 @@ bool blockchain_storage::is_tx_related_to_altblock(crypto::hash tx_id) const
|
|||
auto it = m_alternative_chains_txs.find(tx_id);
|
||||
return it != m_alternative_chains_txs.end();
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::is_pre_hardfork_tx_freeze_period_active() const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
if (!is_hardfork_active(ZANO_HARDFORK_05))
|
||||
return false;
|
||||
|
||||
uint64_t next_block_height = m_db_blocks.size(); // top block height + 1
|
||||
size_t current_hardfork_id = m_core_runtime_config.hard_forks.get_the_most_recent_hardfork_id_for_height(next_block_height);
|
||||
size_t next_hardfork_id = current_hardfork_id + 1;
|
||||
if (next_hardfork_id >= ZANO_HARDFORKS_TOTAL)
|
||||
return false;
|
||||
|
||||
uint64_t next_hf_height_active_after = m_core_runtime_config.hard_forks.m_height_the_hardfork_n_active_after[next_hardfork_id];
|
||||
|
||||
bool result = (next_block_height + m_core_runtime_config.pre_hardfork_tx_freeze_period > next_hf_height_active_after);
|
||||
return result;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::get_block_extended_info_by_hash(const crypto::hash &h, block_extended_info &blk) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ namespace currency
|
|||
bool get_block_by_height(uint64_t h, block &blk) const;
|
||||
bool is_tx_related_to_altblock(crypto::hash tx_id) const;
|
||||
//void get_all_known_block_ids(std::list<crypto::hash> &main, std::list<crypto::hash> &alt, std::list<crypto::hash> &invalid) const;
|
||||
bool is_pre_hardfork_tx_freeze_period_active() const;
|
||||
|
||||
bc_attachment_services_manager& get_attachment_services_manager(){ return m_services_mgr; }
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ namespace currency
|
|||
core_time_func_t get_core_time;
|
||||
uint64_t hf4_minimum_mixins;
|
||||
wide_difficulty_type max_pos_difficulty;
|
||||
uint64_t pre_hardfork_tx_freeze_period; // number of blocks before the hardfork activatio when no new txs are accepted (effective from HF5); 0 means feature is switched off
|
||||
|
||||
hard_forks_descriptor hard_forks;
|
||||
std::array<int, ZANO_HARDFORKS_TOTAL> min_build_numbers_for_hard_forks;
|
||||
|
|
@ -137,6 +138,7 @@ namespace currency
|
|||
pc.max_alt_blocks = CURRENCY_ALT_BLOCK_MAX_COUNT;
|
||||
pc.hf4_minimum_mixins = CURRENCY_HF4_MANDATORY_DECOY_SET_SIZE;
|
||||
pc.max_pos_difficulty = wide_difficulty_type(POS_MAX_DIFFICULTY_ALLOWED);
|
||||
pc.pre_hardfork_tx_freeze_period = CURRENCY_PRE_HARDFORK_TX_FREEZE_PERIOD;
|
||||
|
||||
// TODO: refactor the following
|
||||
pc.hard_forks.set_hardfork_height(1, ZANO_HARDFORK_01_AFTER_HEIGHT);
|
||||
|
|
@ -144,7 +146,8 @@ namespace currency
|
|||
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.hard_forks.set_hardfork_height(6, ZANO_HARDFORK_06_AFTER_HEIGHT); pc.min_build_numbers_for_hard_forks[6] = ZANO_HARDFORK_06_MIN_BUILD_VER;
|
||||
static_assert(6 + 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);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#define CURRENCY_DEFAULT_DECOY_SET_SIZE 10
|
||||
#define CURRENCY_HF4_MANDATORY_DECOY_SET_SIZE 15
|
||||
#define CURRENCY_HF4_MANDATORY_MIN_COINAGE 10
|
||||
#define CURRENCY_PRE_HARDFORK_TX_FREEZE_PERIOD 60 // number of blocks before the hardfork activation when no new txs are accepted (effective from HF5)
|
||||
|
||||
#define CURRENT_BLOCK_MINOR_VERSION 0
|
||||
#define CURRENCY_BLOCK_FUTURE_TIME_LIMIT 60*60*2
|
||||
|
|
@ -269,19 +270,29 @@
|
|||
#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_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 354
|
||||
#define ZANO_HARDFORK_05_MIN_BUILD_VER 380
|
||||
|
||||
#define ZANO_HARDFORK_06_AFTER_HEIGHT 999999999999999999
|
||||
#define ZANO_HARDFORK_06_MIN_BUILD_VER 380
|
||||
#else
|
||||
// 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 100
|
||||
#define ZANO_HARDFORK_04_TIMESTAMP_ACTUAL 1738659600ull // block 100, 2025-00-00 00:00:00 UTC
|
||||
|
||||
#define ZANO_HARDFORK_05_AFTER_HEIGHT 200
|
||||
#define ZANO_HARDFORK_05_MIN_BUILD_VER 379
|
||||
|
||||
#define ZANO_HARDFORK_06_AFTER_HEIGHT 999999999999999999
|
||||
#define ZANO_HARDFORK_06_MIN_BUILD_VER 379
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -291,7 +302,8 @@
|
|||
#define ZANO_HARDFORK_03 3
|
||||
#define ZANO_HARDFORK_04_ZARCANUM 4
|
||||
#define ZANO_HARDFORK_05 5
|
||||
#define ZANO_HARDFORKS_TOTAL 6
|
||||
#define ZANO_HARDFORK_06 6
|
||||
#define ZANO_HARDFORKS_TOTAL 7
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ namespace currency
|
|||
void resume_mine();
|
||||
blockchain_storage& get_blockchain_storage() { return m_blockchain_storage; }
|
||||
const blockchain_storage& get_blockchain_storage() const { return m_blockchain_storage; }
|
||||
const core_runtime_config& get_runtime_config() const { return m_blockchain_storage.get_core_runtime_config(); }
|
||||
//debug functions
|
||||
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
||||
void print_blockchain_index();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue