diff --git a/sim/consensus.py b/sim/consensus.py index 83a0d7b..1db29b9 100644 --- a/sim/consensus.py +++ b/sim/consensus.py @@ -7,6 +7,7 @@ DIFF_DAMP_FACTOR = 3 AR_DAMP_FACTOR = 13 +NEW_AR_DAMP = 0 CLAMP_FACTOR = 2 BLOCK_TIME_WINDOW = DIFFICULTY_ADJUST_WINDOW * 60 @@ -81,6 +82,15 @@ def clamp(actual: int, goal: int, clamp_factor: int) -> int: def secondary_pow_scaling(height: int, diff_data: List[HeaderInfo]) -> int: + if NEW_AR_DAMP > 0: + last = diff_data[-1] + scale = last.scaling + target_pct = secondary_pow_ratio(height) + if last.is_secondary: + scale -= (100 - target_pct) / NEW_AR_DAMP + else: + scale += target_pct / NEW_AR_DAMP + return max(AR_DAMP_FACTOR, scale) diff_iter = iter(diff_data) next(diff_iter) secondary_count = 0 diff --git a/simulation.py b/simulation.py index a96984c..1d5e039 100644 --- a/simulation.py +++ b/simulation.py @@ -10,14 +10,14 @@ def primary_graph_rate(edge_bits: int, height: int): if edge_bits == 30: - return 0 if height < 50000 else 0 + return 0 if height < 40000 else 0 if edge_bits == 31: - return 1 if height < 50000 else 2 + return 1 if height < 40000 else 2 return 0 def secondary_graph_rate(height: int): - return 36 if height < 50000 else 18 + return 36 if height < 40000 else 36 def test_difficulty_adjustment():