فهرست منبع

removed cashier functions from user-facing RPC flow

lunar-mining 5 سال پیش
والد
کامیت
b8464dfbd8
4فایلهای تغییر یافته به همراه4 افزوده شده و 50 حذف شده
  1. 0 10
      src/cli/drk_cli.rs
  2. 2 15
      src/rpc/adapter.rs
  3. 2 24
      src/rpc/jsonserver.rs
  4. 0 1
      src/service/cashier.rs

+ 0 - 10
src/cli/drk_cli.rs

@@ -58,7 +58,6 @@ impl WithdrawParams {
 
 pub struct DrkCli {
     pub verbose: bool,
-    pub cashier: bool,
     pub wallet: bool,
     pub key: bool,
     pub get_key: bool,
@@ -90,13 +89,6 @@ impl DrkCli {
                     .help_heading(Some("Say hello"))
                     .takes_value(false),
             )
-            .arg(
-                Arg::new("cashier")
-                    .short('c')
-                    .long("cashier")
-                    .help_heading(Some("Create a cashier wallet"))
-                    .takes_value(false),
-            )
             .arg(
                 Arg::new("key")
                     .short('k')
@@ -184,7 +176,6 @@ impl DrkCli {
             .get_matches();
 
         let verbose = app.is_present("verbose");
-        let cashier = app.is_present("cashier");
         let wallet = app.is_present("wallet");
         let key = app.is_present("key");
         let info = app.is_present("info");
@@ -242,7 +233,6 @@ impl DrkCli {
 
         Ok(Self {
             verbose,
-            cashier,
             wallet,
             key,
             get_key,

+ 2 - 15
src/rpc/adapter.rs

@@ -47,12 +47,6 @@ impl RpcAdapter {
         Ok(())
     }
 
-    pub fn init_cashier_db(&self) -> Result<()> {
-        debug!(target: "adapter", "init_cashier_db() [START]");
-        self.wallet.init_cashier_db()?;
-        Ok(())
-    }
-
     pub fn key_gen(&self) -> Result<()> {
         debug!(target: "adapter", "key_gen() [START]");
         let (public, private) = self.wallet.key_gen();
@@ -62,13 +56,6 @@ impl RpcAdapter {
         Ok(())
     }
 
-    pub fn cash_key_gen(&self) -> Result<()> {
-        debug!(target: "adapter", "key_gen() [START]");
-        let (public, private) = self.wallet.cash_key_gen();
-        self.wallet.put_keypair(public, private)?;
-        Ok(())
-    }
-
     pub fn get_key(&self) -> Result<String> {
         debug!(target: "adapter", "get_key() [START]");
         let key_public = self.wallet.get_public()?;
@@ -76,8 +63,8 @@ impl RpcAdapter {
         Ok(bs58_address)
     }
 
-    pub fn get_cash_key(&self) -> Result<String> {
-        debug!(target: "adapter", "get_cash_key() [START]");
+    pub fn get_cash_public(&self) -> Result<String> {
+        debug!(target: "adapter", "get_cash_public() [START]");
         let cashier_public = self.wallet.get_cashier_public()?;
         let bs58_address = bs58::encode(serialize(&cashier_public)).into_string();
         Ok(bs58_address)

+ 2 - 24
src/rpc/jsonserver.rs

@@ -154,10 +154,10 @@ impl RpcInterface {
         });
 
         let self1 = self.clone();
-        io.add_method("get_cash_key", move |_| {
+        io.add_method("get_cash_public", move |_| {
             let self2 = self1.clone();
             async move {
-                let cash_key = self2.adapter.get_cash_key()?;
+                let cash_key = self2.adapter.get_cash_public()?;
                 Ok(jsonrpc_core::Value::String(cash_key))
             }
         });
@@ -202,28 +202,6 @@ impl RpcInterface {
             }
         });
 
-        let self1 = self.clone();
-        io.add_method("cash_key_gen", move |_| {
-            let self2 = self1.clone();
-            async move {
-                self2.adapter.cash_key_gen()?;
-                Ok(jsonrpc_core::Value::String(
-                    "key generation successful".into(),
-                ))
-            }
-        });
-
-        let self1 = self.clone();
-        io.add_method("create_cashier_wallet", move |_| {
-            let self2 = self1.clone();
-            async move {
-                self2.adapter.init_cashier_db()?;
-                Ok(jsonrpc_core::Value::String(
-                    "cashier wallet creation successful".into(),
-                ))
-            }
-        });
-
         let self1 = self.clone();
         io.add_method("deposit", move |_| {
             let self2 = self1.clone();

+ 0 - 1
src/service/cashier.rs

@@ -80,7 +80,6 @@ impl CashierService {
     }
 
     async fn mint_dbtc(&mut self, dkey_pub: jubjub::SubgroupPoint, value: u64) -> Result<()> {
-        // Change to adapter
         let cashier_secret = self.wallet.get_cashier_private().unwrap();
 
         let builder = tx::TransactionBuilder {