Bläddra i källkod

[consensus] increase pid i paramter

mohab metwally 3 år sedan
förälder
incheckning
a4e3369ef0
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 1 1
      src/consensus/constants.rs
  2. 2 2
      src/consensus/state.rs

+ 1 - 1
src/consensus/constants.rs

@@ -46,7 +46,7 @@ lazy_static! {
     pub static ref  TI: Float10 = FLOAT10_ONE.clone();
     pub static ref  TD: Float10 = FLOAT10_ONE.clone();
     pub static ref  KP: Float10 = Float10::from_str_native("0.2").unwrap().with_precision(RADIX_BITS).value();
-    pub static ref  KI: Float10 = Float10::from_str_native("0.05").unwrap().with_precision(RADIX_BITS).value();
+    pub static ref  KI: Float10 = Float10::from_str_native("0.043").unwrap().with_precision(RADIX_BITS).value();
     pub static ref  KD: Float10 = FLOAT10_ONE.clone();
     pub static ref PID_OUT_STEP: Float10  = Float10::from_str_native("0.1").unwrap().with_precision(RADIX_BITS).value();
     pub static ref MAX_DER: Float10 = Float10::from_str_native("0.1").unwrap().with_precision(RADIX_BITS).value();

+ 2 - 2
src/consensus/state.rs

@@ -264,7 +264,6 @@ impl ConsensusState {
         let coin = LeadCoin::new(
             eta,
             rand::thread_rng().gen_range(0..1000),
-            //constants::LOTTERY_HEAD_START, // TODO: TESTNET: Why is this constant being used?
             slot,
             epoch_secrets.secret_keys[0].inner(),
             epoch_secrets.merkle_roots[0],
@@ -383,7 +382,7 @@ impl ConsensusState {
     fn f_int(&self) -> Float10 {
         let mut sum = constants::FLOAT10_ZERO.clone();
         let lead_history_len = self.leaders_history.len();
-        let history_begin_index = if lead_history_len > 5 { lead_history_len - 5 } else { 0 };
+        let history_begin_index = if lead_history_len > 10 { lead_history_len - 10 } else { 0 };
 
         for lf in &self.leaders_history[history_begin_index..] {
             sum += Float10::try_from(lf.clone()).unwrap().abs();
@@ -425,6 +424,7 @@ impl ConsensusState {
         let mut highest_stake_idx = 0;
 
         for (winning_idx, coin) in competing_coins.iter().enumerate() {
+            info!("is_slot_leader: coin stake: {:?}", coin.value);
             let first_winning = coin.is_leader(sigma1, sigma2);
             if first_winning && !won {
                 highest_stake_idx = winning_idx;