瀏覽代碼

fix typo in expect messages

ghassmo 5 年之前
父節點
當前提交
23c1d0c667
共有 3 個文件被更改,包括 13 次插入13 次删除
  1. 2 2
      src/cli/drk_cli.rs
  2. 6 6
      src/client/client.rs
  3. 5 5
      src/wallet/walletdb.rs

+ 2 - 2
src/cli/drk_cli.rs

@@ -203,7 +203,7 @@ impl DrkCli {
                     trn.pub_key = address.to_string();
                     trn.pub_key = address.to_string();
                 }
                 }
                 if let Some(amount) = transfer_sub.value_of("amount") {
                 if let Some(amount) = transfer_sub.value_of("amount") {
-                    trn.amount = amount.parse().expect("couldn't convert the amount to f64");
+                    trn.amount = amount.parse().expect("Convert the amount to f64");
                 }
                 }
                 transfer = Some(trn);
                 transfer = Some(trn);
             }
             }
@@ -218,7 +218,7 @@ impl DrkCli {
                     wdraw.pub_key = address.to_string();
                     wdraw.pub_key = address.to_string();
                 }
                 }
                 if let Some(amount) = withdraw_sub.value_of("amount") {
                 if let Some(amount) = withdraw_sub.value_of("amount") {
-                    wdraw.amount = amount.parse().expect("couldn't convert the amount to f64");
+                    wdraw.amount = amount.parse().expect("Convert the amount to f64");
                 }
                 }
                 withdraw = Some(wdraw);
                 withdraw = Some(wdraw);
             }
             }

+ 6 - 6
src/client/client.rs

@@ -326,24 +326,24 @@ impl ProgramState for State {
     fn is_valid_cashier_public_key(&self, _public: &jubjub::SubgroupPoint) -> bool {
     fn is_valid_cashier_public_key(&self, _public: &jubjub::SubgroupPoint) -> bool {
         // TODO: use walletdb instead of connecting with sqlite directly
         // TODO: use walletdb instead of connecting with sqlite directly
         let conn =
         let conn =
-            Connection::open(self.wallet_path.clone()).expect("Failed to connect to database");
+            Connection::open(self.wallet_path.clone()).expect("Connect to database");
         let mut stmt = conn
         let mut stmt = conn
             .prepare("SELECT key_public FROM cashier WHERE key_public IN (SELECT key_public)")
             .prepare("SELECT key_public FROM cashier WHERE key_public IN (SELECT key_public)")
-            .expect("Cannot generate statement.");
-        stmt.exists([1i32]).expect("Failed to read database")
+            .expect("Generate statement");
+        stmt.exists([1i32]).expect("Read database")
         // do actual validity check
         // do actual validity check
     }
     }
 
 
     fn is_valid_merkle(&self, merkle_root: &MerkleNode) -> bool {
     fn is_valid_merkle(&self, merkle_root: &MerkleNode) -> bool {
         self.merkle_roots
         self.merkle_roots
             .key_exist(*merkle_root)
             .key_exist(*merkle_root)
-            .expect("couldn't check if the merkle_root valid")
+            .expect("Check if the merkle_root valid")
     }
     }
 
 
     fn nullifier_exists(&self, nullifier: &Nullifier) -> bool {
     fn nullifier_exists(&self, nullifier: &Nullifier) -> bool {
         self.nullifiers
         self.nullifiers
             .key_exist(nullifier.repr)
             .key_exist(nullifier.repr)
-            .expect("couldn't check if nullifier exists")
+            .expect("Check if nullifier exists")
     }
     }
 
 
     // load from disk
     // load from disk
@@ -374,7 +374,7 @@ impl State {
 
 
             // Also update all the coin witnesses
             // Also update all the coin witnesses
             for witness in wallet.witnesses.lock().await.iter_mut() {
             for witness in wallet.witnesses.lock().await.iter_mut() {
-                witness.append(node).expect("append to witness");
+                witness.append(node).expect("Append to witness");
             }
             }
 
 
             if let Some((note, secret)) = self.try_decrypt_note(wallet.clone(), enc_note).await {
             if let Some((note, secret)) = self.try_decrypt_note(wallet.clone(), enc_note).await {

+ 5 - 5
src/wallet/walletdb.rs

@@ -109,7 +109,7 @@ impl WalletDb {
                 .get_value_deserialized(
                 .get_value_deserialized(
                     secret
                     secret
                         .pop()
                         .pop()
-                        .expect("unable to load public_key from walletdb"),
+                        .expect("Load public_key from walletdb"),
                 )
                 )
                 .unwrap();
                 .unwrap();
 
 
@@ -167,7 +167,7 @@ impl WalletDb {
                 ":coin_blind": coin_blind,
                 ":coin_blind": coin_blind,
                 ":valcom_blind": valcom_blind,
                 ":valcom_blind": valcom_blind,
                 ":witness": witness,
                 ":witness": witness,
-                ":key_id": key_id.pop().expect("key_id not found!"),
+                ":key_id": key_id.pop().expect("Get key_id"),
             },
             },
         )?;
         )?;
         Ok(())
         Ok(())
@@ -217,7 +217,7 @@ impl WalletDb {
         let public: jubjub::SubgroupPoint = self.get_value_deserialized(
         let public: jubjub::SubgroupPoint = self.get_value_deserialized(
             pub_keys
             pub_keys
                 .pop()
                 .pop()
-                .expect("unable to load public_key from walletdb"),
+                .expect("Load public_key from walletdb"),
         )?;
         )?;
 
 
         Ok(public)
         Ok(public)
@@ -236,7 +236,7 @@ impl WalletDb {
         let public: jubjub::SubgroupPoint = self.get_value_deserialized(
         let public: jubjub::SubgroupPoint = self.get_value_deserialized(
             pub_keys
             pub_keys
                 .pop()
                 .pop()
-                .expect("unable to load cashier public_key from walletdb"),
+                .expect("Load cashier public_key from walletdb"),
         )?;
         )?;
         Ok(public)
         Ok(public)
     }
     }
@@ -253,7 +253,7 @@ impl WalletDb {
         }
         }
         let private: jubjub::Fr = self.get_value_deserialized(
         let private: jubjub::Fr = self.get_value_deserialized(
             keys.pop()
             keys.pop()
-                .expect("unable to load private key from walletdb"),
+                .expect("Load private key from walletdb"),
         )?;
         )?;
         Ok(private)
         Ok(private)
     }
     }