Two year secondary pow ratio fix (#2037)
* Tweak (consensus breaking) secondary_pow_ratio * Look at chain type for sec pow ratio calc (hardfork is t4 only)
This commit is contained in:
committed by
Ignotus Peverell
parent
60cbcbd96b
commit
7dee490962
+11
-1
@@ -63,7 +63,17 @@ pub const COINBASE_MATURITY: u64 = DAY_HEIGHT;
|
||||
/// function of block height (time). Starts at 90% losing a percent
|
||||
/// approximately every week. Represented as an integer between 0 and 100.
|
||||
pub fn secondary_pow_ratio(height: u64) -> u64 {
|
||||
90u64.saturating_sub(height / WEEK_HEIGHT)
|
||||
// TODO - this should all be cleaned up and simplified before mainnet.
|
||||
if global::is_mainnet() {
|
||||
90u64.saturating_sub(height / (2 * YEAR_HEIGHT / 90))
|
||||
} else {
|
||||
if height < T4_CUCKAROO_HARDFORK {
|
||||
// Maintaining pre hardfork testnet4 behavior
|
||||
90u64.saturating_sub(height / WEEK_HEIGHT)
|
||||
} else {
|
||||
90u64.saturating_sub(height / (2 * YEAR_HEIGHT / 90))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Cuckoo-cycle proof size (cycle length)
|
||||
|
||||
+8
-2
@@ -19,8 +19,8 @@
|
||||
use consensus::HeaderInfo;
|
||||
use consensus::{
|
||||
graph_weight, BASE_EDGE_BITS, BLOCK_TIME_SEC, COINBASE_MATURITY, CUT_THROUGH_HORIZON,
|
||||
DAY_HEIGHT, DIFFICULTY_ADJUST_WINDOW, INITIAL_DIFFICULTY, PROOFSIZE, SECOND_POW_EDGE_BITS,
|
||||
STATE_SYNC_THRESHOLD, T4_CUCKAROO_HARDFORK, UNIT_DIFFICULTY, DEFAULT_MIN_EDGE_BITS,
|
||||
DAY_HEIGHT, DEFAULT_MIN_EDGE_BITS, DIFFICULTY_ADJUST_WINDOW, INITIAL_DIFFICULTY, PROOFSIZE,
|
||||
SECOND_POW_EDGE_BITS, STATE_SYNC_THRESHOLD, T4_CUCKAROO_HARDFORK, UNIT_DIFFICULTY,
|
||||
};
|
||||
use pow::{self, new_cuckaroo_ctx, new_cuckatoo_ctx, EdgeType, PoWContext};
|
||||
/// An enum collecting sets of parameters used throughout the
|
||||
@@ -294,6 +294,12 @@ pub fn is_production_mode() -> bool {
|
||||
|| ChainTypes::Mainnet == *param_ref
|
||||
}
|
||||
|
||||
/// Are we in mainnet?
|
||||
pub fn is_mainnet() -> bool {
|
||||
let param_ref = CHAIN_TYPE.read();
|
||||
ChainTypes::Mainnet == *param_ref
|
||||
}
|
||||
|
||||
/// Helper function to get a nonce known to create a valid POW on
|
||||
/// the genesis block, to prevent it taking ages. Should be fine for now
|
||||
/// as the genesis block POW solution turns out to be the same for every new
|
||||
|
||||
Reference in New Issue
Block a user