Quellcode durchsuchen

clean unused imports, commented code

mohab metwally vor 3 Jahren
Ursprung
Commit
bc8d7886da

+ 2 - 6
bin/darkfid/src/main.rs

@@ -49,7 +49,7 @@ use darkfi::{
         },
         server::{listen_and_serve, RequestHandler},
     },
-    util::{path::expand_path,time::Timestamp},
+    util::{path::expand_path},
     wallet::{walletdb::init_wallet, WalletPtr},
     Error, Result,
 };
@@ -300,7 +300,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'_>>) -> Result<()> {
     let sled_db = sled::open(&db_path)?;
 
     // Initialize validator state
-    let (mut bootstrap_ts, mut genesis_ts, genesis_data, initial_distribution) = match args.chain.as_str() {
+    let (bootstrap_ts, genesis_ts, genesis_data, initial_distribution) = match args.chain.as_str() {
         "mainnet" => (
             *MAINNET_BOOTSTRAP_TIMESTAMP,
             *MAINNET_GENESIS_TIMESTAMP,
@@ -310,8 +310,6 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'_>>) -> Result<()> {
         "testnet" => (
             *TESTNET_BOOTSTRAP_TIMESTAMP,
             *TESTNET_GENESIS_TIMESTAMP,
-            //Timestamp::current_time(),
-            //Timestamp::current_time(),
             *TESTNET_GENESIS_HASH_BYTES,
             *TESTNET_INITIAL_DISTRIBUTION,
         ),
@@ -320,8 +318,6 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'_>>) -> Result<()> {
             return Err(Error::UnsupportedChain)
         }
     };
-    //genesis_ts.add(-9);
-    //bootstrap_ts.add(-9);
     // Parse faucet addresses
     let mut faucet_pubkeys = vec![];
 

+ 4 - 9
src/consensus/leadcoin.rs

@@ -293,7 +293,7 @@ impl LeadCoin {
                      ZERO
         ];
         let y_seed_hash = poseidon_hash(y_seed);
-        let (y_mu, rho_mu) = Self::election_seeds(current_eta, current_slot);
+        let (y_mu, _) = Self::election_seeds(current_eta, current_slot);
         let y_msg = [y_seed_hash, y_mu];
         let y = poseidon_hash(y_msg);
 
@@ -301,8 +301,9 @@ impl LeadCoin {
 
         let target =  sigma1 * value + sigma2 * value * value;
 
-        let mut y_t_str = format!("{:?},{:?}\n", y,target);
-        let mut f = File::options().append(true).open(constants::LOTTERY_HISTORY_LOG).unwrap();
+        let y_t_str = format!("{:?},{:?}\n", y,target);
+        let f = File::options().append(true).open(constants::LOTTERY_HISTORY_LOG).unwrap();
+
         {
             let mut writer = BufWriter::new(f);
             writer.write(&y_t_str.into_bytes()).unwrap();
@@ -365,12 +366,6 @@ impl LeadCoin {
         }
     }
 
-    fn coin_commitment_base(&self) -> pallas::Base {
-        let c1_cm_coord = self.coin1_commitment.to_affine().coordinates().unwrap();
-        let c1_cm_msg = [*c1_cm_coord.x(), *c1_cm_coord.y()];
-        poseidon_hash(c1_cm_msg)
-    }
-
     /// Try to create a ZK proof of consensus leadership
     pub fn create_lead_proof(
         &self,

+ 1 - 1
src/consensus/proto/protocol_proposal.rs

@@ -32,7 +32,7 @@ use crate::{
 };
 
 use darkfi_sdk::{
-    pasta::{arithmetic::CurveAffine, group::Curve, pallas},
+    pasta::{pallas},
 };
 use rand::rngs::OsRng;
 use halo2_proofs::arithmetic::Field;

+ 1 - 1
src/consensus/state.rs

@@ -403,7 +403,7 @@ impl ConsensusState {
         info!("extend_leaders_history(): Current leaders history: {:?}", self.leaders_history);
         let mut count_str : String = count.to_string();
         count_str.push_str(",");
-        let mut f = File::options().append(true).open(constants::LEADER_HISTORY_LOG).unwrap();
+        let f = File::options().append(true).open(constants::LEADER_HISTORY_LOG).unwrap();
         {
             let mut writer = BufWriter::new(f);
             writer.write(&count_str.into_bytes()).unwrap();

+ 1 - 1
src/consensus/task/proposal.rs

@@ -29,7 +29,7 @@ use crate::{
 };
 
 use darkfi_sdk::{
-    pasta::{arithmetic::CurveAffine, group::Curve, pallas},
+    pasta::{pallas},
 };
 use rand::rngs::OsRng;
 use halo2_proofs::arithmetic::Field;

+ 0 - 1
src/consensus/utils.rs

@@ -21,7 +21,6 @@ use dashu::integer::{IBig, Sign};
 use log::debug;
 use dashu::integer::UBig;
 use darkfi_sdk::pasta::group::ff::PrimeField;
-use crate::consensus::{constants::RADIX_BITS};
 
 use super::Float10;