Initial block difficulty adjustment + difficulty adjustment scenario modification (#1217)
* Handle SIGINT and SIGTERM (#1180) * Handle SIGINT and SIGTERM * pin croaring to version 0.3.2 until we get the clang conflict sorted out (#1183) * document proposals for - (#1190) * conditional timelocked outputs, and * conditional relative timelocked outputs * problem with validation on rewind * update difficulty scenarios to display much more data * correct average sum output * update pre-genesis block padding to just use previous block's data
This commit is contained in:
@@ -215,7 +215,7 @@ where
|
||||
let earliest_ts = window_earliest[MEDIAN_TIME_INDEX as usize];
|
||||
|
||||
// Obtain the median window for the latest time period
|
||||
// i.e. the last MEDIAN_TIME_WINDOW elements
|
||||
// i.e. the last MEDIAN_TIME_WINDOW elements
|
||||
let mut window_latest: Vec<u64> = diff_data
|
||||
.iter()
|
||||
.skip(DIFFICULTY_ADJUST_WINDOW as usize)
|
||||
|
||||
+4
-8
@@ -249,7 +249,6 @@ where
|
||||
live_intervals[i].0 = live_intervals[i].0 - live_intervals[i - 1].0;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Remove genesis "interval"
|
||||
if live_intervals.len() > 1 {
|
||||
live_intervals.remove(0);
|
||||
@@ -259,14 +258,11 @@ where
|
||||
}
|
||||
let mut interval_index = live_intervals.len() - 1;
|
||||
let mut last_ts = last_n.first().as_ref().unwrap().as_ref().unwrap().0;
|
||||
// fill in simulated blocks, repeating whatever pattern we've obtained from
|
||||
// real data
|
||||
// if we have, say, 15 blocks so far with intervals of I1..I15, then
|
||||
// the 71-15=56 pre genesis blocks will have
|
||||
// intervals/difficulties I1..I15 I1..I15 I1..I15 I1..I11
|
||||
let last_diff = live_intervals[live_intervals.len()-1].1;
|
||||
// fill in simulated blocks with values from the previous real block
|
||||
|
||||
for _ in 0..block_count_difference {
|
||||
last_ts = last_ts.saturating_sub(live_intervals[interval_index].0);
|
||||
let last_diff = &live_intervals[interval_index].1;
|
||||
last_ts = last_ts.saturating_sub(live_intervals[live_intervals.len()-1].0);
|
||||
last_n.insert(0, Ok((last_ts, last_diff.clone())));
|
||||
interval_index = match interval_index {
|
||||
0 => live_intervals.len() - 1,
|
||||
|
||||
Reference in New Issue
Block a user