Browse Source

consensus: fixed genesis slot eta

aggstam 3 năm trước cách đây
mục cha
commit
f70dd6c054
2 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 1 1
      src/consensus/constants.rs
  2. 2 2
      src/consensus/state.rs

+ 1 - 1
src/consensus/constants.rs

@@ -31,7 +31,7 @@ lazy_static! {
     pub static ref TESTNET_GENESIS_HASH_BYTES: blake3::Hash = blake3::hash(b"darkfi_testnet");
 
     /// Genesis timestamp for the testnet chain
-    pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1671329520);
+    pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1671330180);
 
     // Commonly used Float10
     pub static ref  FLOAT10_ZERO: Float10 = Float10::from_str_native("0").unwrap().with_precision(RADIX_BITS).value();

+ 2 - 2
src/consensus/state.rs

@@ -93,7 +93,7 @@ impl ConsensusState {
             offset: None,
             forks: vec![],
             epoch: 0,
-            epoch_eta: pallas::Base::one(),
+            epoch_eta: pallas::Base::zero(),
             slot_checkpoints: vec![],
             leaders_history: vec![0],
             coins: vec![],
@@ -191,9 +191,9 @@ impl ConsensusState {
     pub async fn init_coins(&mut self) -> Result<()> {
         self.epoch = self.current_epoch();
         if self.slot_checkpoints.is_empty() {
-            self.epoch_eta = self.get_eta();
             // Create slot checkpoint if not on genesis slot (already in db)
             if self.current_slot() != 0 {
+                self.epoch_eta = self.get_eta();
                 let (sigma1, sigma2) = self.sigmas();
                 self.generate_slot_checkpoint(sigma1, sigma2);
             }