Explorar el Código

darkfid: removed redundant bootstrap config option

skoupidi hace 7 meses
padre
commit
aa2c7c2989

+ 0 - 9
bin/darkfid/darkfid_config.toml

@@ -32,9 +32,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 
@@ -158,9 +155,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 
@@ -289,9 +283,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 # Garbage collection task transactions batch size
 txs_batch_size = 50
 

+ 0 - 11
bin/darkfid/src/main.rs

@@ -123,10 +123,6 @@ pub struct BlockchainNetwork {
     /// Optional sync checkpoint hash
     checkpoint: Option<String>,
 
-    #[structopt(long)]
-    /// Optional bootstrap timestamp
-    bootstrap: Option<u64>,
-
     #[structopt(long)]
     /// Garbage collection task transactions batch size
     txs_batch_size: Option<usize>,
@@ -169,12 +165,6 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     let bytes = base64::decode(genesis_block.trim()).unwrap();
     let genesis_block: BlockInfo = deserialize_async(&bytes).await?;
 
-    // Compute the bootstrap timestamp
-    let bootstrap = match blockchain_config.bootstrap {
-        Some(b) => b,
-        None => genesis_block.header.timestamp.inner(),
-    };
-
     // Initialize or open sled database
     let db_path = expand_path(&blockchain_config.database)?;
     let sled_db = sled_overlay::sled::open(&db_path)?;
@@ -249,7 +239,6 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         skip_sync: blockchain_config.skip_sync,
         checkpoint_height: blockchain_config.checkpoint_height,
         checkpoint: blockchain_config.checkpoint,
-        bootstrap,
     };
     daemon
         .start(

+ 5 - 8
bin/darkfid/src/task/consensus.rs

@@ -42,8 +42,6 @@ pub struct ConsensusInitTaskConfig {
     pub checkpoint_height: Option<u32>,
     /// Optional sync checkpoint hash
     pub checkpoint: Option<String>,
-    /// Optional bootstrap timestamp
-    pub bootstrap: u64,
 }
 
 /// Sync the node consensus state and start the corresponding task, based on node type.
@@ -57,13 +55,12 @@ pub async fn consensus_init_task(
     //       until its healthy again
     node.validator.consensus.healthcheck().await?;
 
-    // Check if network is configured to start in the future.
-    // NOTE: Always configure the network to start in the future when bootstrapping
-    // or restarting it.
+    // Check if network genesis is in the future.
     let current = Timestamp::current_time().inner();
-    if current < config.bootstrap {
-        let diff = config.bootstrap - current;
-        info!(target: "darkfid::task::consensus_init_task", "Waiting for network bootstrap: {diff} seconds");
+    let genesis = node.validator.consensus.module.read().await.genesis.inner();
+    if current < genesis {
+        let diff = genesis - current;
+        info!(target: "darkfid::task::consensus_init_task", "Waiting for network genesis: {diff} seconds");
         sleep(diff).await;
     }
 

+ 0 - 2
bin/darkfid/src/tests/mod.rs

@@ -267,7 +267,6 @@ fn darkfid_programmatic_control() -> Result<()> {
                     .get_headroot()
                     .unwrap()
                     .unwrap();
-                let bootstrap = genesis_block.header.timestamp.inner();
                 let config = darkfi::validator::ValidatorConfig {
                     confirmation_threshold: 1,
                     pow_target: 20,
@@ -279,7 +278,6 @@ fn darkfid_programmatic_control() -> Result<()> {
                     skip_sync: true,
                     checkpoint_height: None,
                     checkpoint: None,
-                    bootstrap,
                 };
                 let rpc_settings = RpcSettings {
                     listen: Url::parse("tcp://127.0.0.1:8240").unwrap(),

+ 0 - 3
contrib/localnet/darkfid-five-nodes/darkfid0.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-five-nodes/darkfid1.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-five-nodes/darkfid2.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-five-nodes/darkfid3.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-five-nodes/darkfid4.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-single-node/darkfid.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1718807405
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-small/darkfid0.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-small/darkfid1.toml

@@ -43,9 +43,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 ## Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL

+ 0 - 3
contrib/localnet/darkfid-small/darkfid2.toml

@@ -35,9 +35,6 @@ skip_fees = false
 # Optional sync checkpoint hash
 #checkpoint = ""
 
-# Optional bootstrap timestamp
-#bootstrap = 1712581283
-
 # Localnet JSON-RPC settings
 [network_config."localnet".rpc]
 # JSON-RPC listen URL