Explorar o código

use debug macro instead of info for debugging & add proper name for target field in each debug macro

ghassmo %!s(int64=5) %!d(string=hai) anos
pai
achega
6fa951b5f3

+ 0 - 2
src/bin/cashierd.rs

@@ -8,7 +8,6 @@ use drk::service::CashierService;
 use drk::util::join_config_path;
 use drk::wallet::{WalletDb, CashierDb};
 use drk::{Error, Result};
-use log::*;
 
 use async_executor::Executor;
 use easy_parallel::Parallel;
@@ -29,7 +28,6 @@ async fn start(executor: Arc<Executor<'_>>, config: Arc<CashierdConfig>) -> Resu
         config.password.clone(),
     )?);
 
-    debug!(target: "cashierd", "starting cashier service");
     let mut cashier = CashierService::new(
         accept_addr,
         btc_endpoint,

+ 5 - 5
src/bin/drk.rs

@@ -8,7 +8,7 @@ use drk::rpc::jsonrpc::JsonResult;
 use drk::util::join_config_path;
 use drk::{Error, Result};
 
-use log::info;
+use log::debug;
 
 struct Drk {
     url: String,
@@ -22,7 +22,7 @@ impl Drk {
     async fn request(&self, method_name: &str, r: jsonrpc::JsonRequest) -> Result<()> {
         // TODO: Return actual JSON result
         let data = surf::Body::from_json(&r)?;
-        info!("--> {:?}", r);
+        debug!(target: "DRK",  "--> {:?}", r);
         let mut req = surf::post(&self.url).body(data).await?;
 
         let resp = req.take_body();
@@ -31,13 +31,13 @@ impl Drk {
         let v: JsonResult = serde_json::from_str(&json)?;
         match v {
             JsonResult::Resp(r) => {
-                info!("<-- {:?}", r);
+                debug!(target: "DRK", "<-- {:?}", r);
                 println!("{}: {}", method_name, r.result);
                 return Ok(());
             }
 
             JsonResult::Err(e) => {
-                info!("<-- {:?}", e);
+                debug!(target: "DRK", "<-- {:?}", e);
                 return Err(Error::JsonRpcError(e.error.message.to_string()));
             }
         };
@@ -157,7 +157,7 @@ fn main() -> Result<()> {
         let logger_config = ConfigBuilder::new().set_time_format_str("%T%.6f").build();
 
         let debug_level = if options.verbose {
-            LevelFilter::Info
+            LevelFilter::Debug
         } else {
             LevelFilter::Off
         };

+ 5 - 5
src/client/client.rs

@@ -77,7 +77,7 @@ impl Client {
         };
 
         // create gateway client
-        debug!(target: "Client", "Creating GatewayClient");
+        debug!(target: "CLIENT", "Creating GatewayClient");
         let gateway = GatewayClient::new(gateway_addrs.0, gateway_addrs.1, slabstore)?;
 
         Ok(Self {
@@ -102,11 +102,11 @@ impl Client {
         rpc_url: SocketAddr,
     ) -> Result<()> {
         // create cashier client
-        debug!(target: "Client", "Creating cashier client");
+        debug!(target: "CLIENT", "Creating cashier client");
         let mut cashier_client = CashierClient::new(cashier_addr)?;
 
         // start subscribing
-        debug!(target: "Client", "Start subscriber");
+        debug!(target: "CLIENT", "Start subscriber");
         let gateway_slabs_sub: GatewaySlabsSubscriber =
             self.gateway.start_subscriber(executor.clone()).await?;
 
@@ -136,7 +136,7 @@ impl Client {
         )?);
 
         // start the rpc server
-        debug!(target: "Client", "Start RPC server");
+        debug!(target: "CLIENT", "Start RPC server");
         let io = Arc::new(adapter.handle_input()?);
         let _ = jsonserver::start(executor.clone(), rpc_url, io).await?;
 
@@ -288,7 +288,7 @@ impl Client {
         wallet: WalletPtr,
     ) -> Result<()> {
         // start subscribing
-        debug!(target: "Client", "Start subscriber");
+        debug!(target: "CLIENT", "Start subscriber");
         let gateway_slabs_sub: GatewaySlabsSubscriber = client
             .lock()
             .await

+ 9 - 9
src/rpc/adapters/user_adapter.rs

@@ -40,7 +40,7 @@ impl UserAdapter {
         deposit_channel: DepositChannel,
         withdraw_channel: WithdrawChannel,
     ) -> Result<Self> {
-        debug!(target: "ADAPTER", "new() [CREATING NEW WALLET]");
+        debug!(target: "RPC USER ADAPTER", "new() [CREATING NEW WALLET]");
         Ok(Self {
             wallet,
             transfer_channel,
@@ -156,36 +156,36 @@ impl UserAdapter {
     }
 
     pub fn init_db(&self) -> Result<()> {
-        debug!(target: "adapter", "init_db() [START]");
+        debug!(target: "RPC USER ADAPTER", "init_db() [START]");
         self.wallet.init_db()?;
         Ok(())
     }
 
     pub fn key_gen(&self) -> Result<()> {
-        debug!(target: "adapter", "key_gen() [START]");
+        debug!(target: "RPC USER ADAPTER", "key_gen() [START]");
         let (public, private) = self.wallet.key_gen();
-        debug!(target: "adapter", "Created keypair...");
-        debug!(target: "adapter", "Attempting to write to database...");
+        debug!(target: "RPC USER ADAPTER", "Created keypair...");
+        debug!(target: "RPC USER ADAPTER", "Attempting to write to database...");
         self.wallet.put_keypair(public, private)?;
         Ok(())
     }
 
     pub fn get_key(&self) -> Result<String> {
-        debug!(target: "adapter", "get_key() [START]");
+        debug!(target: "RPC USER ADAPTER", "get_key() [START]");
         let key_public = self.wallet.get_public()?;
         let bs58_address = bs58::encode(serialize(&key_public)).into_string();
         Ok(bs58_address)
     }
 
     pub fn get_cash_public(&self) -> Result<String> {
-        debug!(target: "adapter", "get_cash_public() [START]");
+        debug!(target: "RPC USER 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)
     }
 
     pub async fn deposit(&self) -> Result<PubAddress> {
-        debug!(target: "adapter", "deposit: START");
+        debug!(target: "RPC USER ADAPTER", "deposit: START");
         let (public, private) = self.wallet.key_gen();
         self.wallet.put_keypair(public, private)?;
         let dkey = self.wallet.get_public()?;
@@ -208,7 +208,7 @@ impl UserAdapter {
     }
 
     async fn withdraw(&self, withdraw_params: WithdrawParams) -> Result<String> {
-        debug!(target: "adapter", "withdraw: START");
+        debug!(target: "RPC USER ADAPTER", "withdraw: START");
         self.withdraw_channel
             .0
             .send(withdraw_params.pub_key)

+ 8 - 8
src/rpc/jsonserver.rs

@@ -23,14 +23,14 @@ pub async fn listen(
         None => format!("http://{}", listener.get_ref().local_addr()?),
         Some(_) => format!("https://{}", listener.get_ref().local_addr()?),
     };
-    println!("Listening on {}", host);
+    debug!(target: "RPC SERVER", "Listening on {}", host);
 
     loop {
         // Accept the next connection.
-        debug!(target: "rpc", "waiting for stream accept [START]");
+        debug!(target: "RPC SERVER", "waiting for stream accept [START]");
         let (stream, _) = listener.accept().await?;
 
-        debug!(target: "rpc", "stream accepted [END]");
+        debug!(target: "RPC SERVER", "stream accepted [END]");
         // Spawn a background task serving this connection.
         let task = match &tls {
             None => {
@@ -44,7 +44,7 @@ pub async fn listen(
                     })
                     .await
                     {
-                        println!("Connection error: {:#?}", err);
+                        debug!(target: "RPC SERVER", "Connection error: {:#?}", err);
                     }
                 })
             }
@@ -61,7 +61,7 @@ pub async fn listen(
                         })
                     }
                     Err(err) => {
-                        println!("Failed to establish secure TLS connection: {:#?}", err);
+                        debug!(target: "RPC SERVER", "Failed to establish secure TLS connection: {:#?}", err);
                         continue;
                     }
                 }
@@ -115,15 +115,15 @@ impl RpcInterface {
         mut req: Request,
         io: Arc<jsonrpc_core::IoHandler>,
     ) -> http_types::Result<Response> {
-        info!("RPC serving {}", req.url());
+        debug!(target: "RPC INTERFACE", "RPC serving {}", req.url());
 
         let request = req.body_string().await?;
 
-        debug!(target: "rpc", "JsonRpcInterface::serve() [PROCESSING INPUT]");
+        debug!(target: "RPC INTERFACE", "JsonRpcInterface::serve() [PROCESSING INPUT]");
         let response = io
             .handle_request_sync(&request)
             .ok_or(Error::BadOperationType)?;
-        debug!(target: "rpc", "JsonRpcInterface::serve() [PROCESSED]");
+        debug!(target: "RPC INTERFACE", "JsonRpcInterface::serve() [PROCESSED]");
 
         let mut res = Response::new(StatusCode::Ok);
         res.insert_header("Content-Type", "text/plain");

+ 5 - 5
src/service/btc.rs

@@ -65,7 +65,7 @@ impl BitcoinKeys {
     }
 
     pub async fn start_subscribe(self: Arc<Self>) -> Result<Option<GetBalanceRes>> {
-        debug!(target: "deposit", "BTC: Subscribe to scriptpubkey");
+        debug!(target: "BTC CLIENT", "Subscribe to scriptpubkey");
         let client = &self.btc_client;
         // Check if script is already subscribed
         if let Some(status_start) = client.script_subscribe(&self.script)? {
@@ -76,19 +76,19 @@ impl BitcoinKeys {
                         if status != status_start {
                             let balance = client.script_get_balance(&self.script)?;
                             if balance.confirmed > 0 {
-                                debug!(target: "deposit", "BTC Balance: Confirmed!");
+                                debug!(target: "BTC CLIENT", "BTC Balance: Confirmed!");
                                 return Ok(Some(balance));
                             } else {
-                                debug!(target: "deposit", "BTC Balance: Unconfirmed!");
+                                debug!(target: "BTC CLIENT", "BTC Balance: Unconfirmed!");
                                 continue;
                             }
                         } else {
-                            debug!(target: "deposit", "ScriptPubKey status has not changed");
+                            debug!(target: "BTC CLIENT", "ScriptPubKey status has not changed");
                             continue;
                         }
                     }
                     None => {
-                        debug!(target: "deposit", "Scriptpubkey does not yet exist in script notifications!");
+                        debug!(target: "BTC CLIENT", "Scriptpubkey does not yet exist in script notifications!");
                         continue;
                     }
                 };

+ 8 - 7
src/service/cashier.rs

@@ -81,7 +81,7 @@ impl CashierService {
         executor: Arc<Executor<'_>>,
         client_wallet: WalletPtr,
     ) -> Result<()> {
-        debug!(target: "Cashier", "Start Cashier");
+        debug!(target: "CASHIER DAEMON", "Start Cashier");
         let service_name = String::from("CASHIER DAEMON");
 
         let mut protocol = RepProtocol::new(self.addr.clone(), service_name.clone());
@@ -182,9 +182,10 @@ impl CashierService {
     ) -> Result<()> {
         let request = msg.1;
         let peer = msg.0;
+        debug!(target: "CASHIER DAEMON", "Get command");
         match request.get_command() {
             0 => {
-                debug!(target: "Cashier", "Get command");
+                debug!(target: "CASHIER DAEMON", "Received deposit request");
                 // Exchange zk_pubkey for bitcoin address
                 let zkpub = request.get_payload();
 
@@ -208,18 +209,19 @@ impl CashierService {
 
                 // send reply
                 send_queue.send((peer, reply)).await?;
-                info!("Received dkey->btc msg");
 
                 // start scheduler for checking balance
-                debug!(target: "BTC", "Subscribing");
+                debug!(target: "CASHIER DAEMON", "Subscribing for deposit");
 
                 let _ = btc_keys.start_subscribe().await?;
 
                 //self.mint_dbtc(deserialize(&zkpub).unwrap(), 100);
 
-                info!("Waiting for address balance");
+                debug!(target: "CASHIER DAEMON","Waiting for address balance");
             }
             1 => {
+
+                debug!(target: "CASHIER DAEMON", "Received withdraw request");
                 let btc_address = request.get_payload();
                 //let btc_address: String = deserialize(&btc_address)?;
                 //let btc_address = bitcoin::util::address::Address::from_str(&btc_address)?;
@@ -247,7 +249,6 @@ impl CashierService {
 
                 send_queue.send((peer, reply)).await?;
 
-                info!("Received withdraw request");
             }
             _ => {
                 return Err(Error::ServicesError("received wrong command"));
@@ -269,7 +270,7 @@ impl CashierClient {
     }
 
     pub async fn start(&mut self) -> Result<()> {
-        debug!(target: "Cashier", "Start CashierClient");
+        debug!(target: "CASHIER CLIENT", "Start CashierClient");
         self.protocol.start().await?;
 
         Ok(())

+ 5 - 7
src/service/gateway.rs

@@ -121,8 +121,8 @@ impl GatewayService {
         let peer = msg.0;
         match request.get_command() {
             0 => {
+                debug!(target: "GATEWAY DAEMON" ,"Received putslab msg");
                 // PUTSLAB
-
                 let slab = request.get_payload();
 
                 // add to slabstore
@@ -139,10 +139,9 @@ impl GatewayService {
 
                 // publish to all subscribes
                 publish_queue.send(slab).await?;
-
-                info!("Received putslab msg");
             }
             1 => {
+                debug!(target: "GATEWAY DAEMON", "Received getslab msg");
                 let index = request.get_payload();
                 let slab = slabstore.get(index)?;
 
@@ -157,16 +156,15 @@ impl GatewayService {
                 send_queue.send((peer, reply)).await?;
 
                 // GETSLAB
-                info!("Received getslab msg");
             }
             2 => {
+                debug!(target: "GATEWAY DAEMON","Received getlastindex msg");
                 let index = slabstore.get_last_index_as_bytes()?;
 
                 let reply = Reply::from(&request, GatewayError::NoError as u32, index);
                 send_queue.send((peer, reply)).await?;
 
                 // GETLASTINDEX
-                info!("Received getlastindex msg");
             }
             _ => {
                 return Err(Error::ServicesError("received wrong command"));
@@ -215,7 +213,7 @@ impl GatewayClient {
     }
 
     pub async fn sync(&mut self) -> Result<u64> {
-        info!("Start Syncing");
+        debug!(target: "GATEWAY CLIENT", "Start Syncing");
         let local_last_index = self.slabstore.get_last_index()?;
 
         let last_index = self.get_last_index().await?;
@@ -230,7 +228,7 @@ impl GatewayClient {
             }
         }
 
-        info!("End Syncing");
+        debug!(target: "GATEWAY CLIENT","End Syncing");
         Ok(last_index)
     }
 

+ 21 - 17
src/service/reqrep.rs

@@ -64,12 +64,12 @@ impl RepProtocol {
     )> {
         let addr = addr_to_string(self.addr);
         self.socket.bind(addr.as_str()).await?;
-        info!("{} SERVICE: Bound To {}", self.service_name, addr);
+        debug!(target: "REP PROTOCOL API", "{} SERVICE: Bound To {}", self.service_name, addr);
         Ok(self.channels.clone())
     }
 
     pub async fn run(&mut self, executor: Arc<Executor<'_>>) -> Result<()> {
-        info!("{} SERVICE: Running", self.service_name);
+        debug!(target: "REP PROTOCOL API", "{} SERVICE: Running", self.service_name);
 
         let (stop_s, stop_r) = async_channel::unbounded::<()>();
 
@@ -116,7 +116,7 @@ impl RepProtocol {
             }
         }
         let _ = stop_task.cancel().await;
-        warn!("{} SERVICE: Stopped", self.service_name);
+        debug!(target: "REP PROTOCOL API","{} SERVICE: Stopped", self.service_name);
         Ok(())
     }
 }
@@ -140,7 +140,7 @@ impl ReqProtocol {
     pub async fn start(&mut self) -> Result<()> {
         let addr = addr_to_string(self.addr);
         self.socket.connect(addr.as_str()).await?;
-        info!("{} SERVICE: Connected To {}", self.service_name, self.addr);
+        debug!(target: "REQ PROTOCOL API","{} SERVICE: Connected To {}", self.service_name, self.addr);
         Ok(())
     }
 
@@ -156,10 +156,11 @@ impl ReqProtocol {
         let req: zeromq::ZmqMessage = req.into();
 
         self.socket.send(req).await?;
-        info!(
-            "{} SERVICE: Sent Request {{ command: {} }}",
-            self.service_name, command
-        );
+        debug!(
+        target: "REQ PROTOCOL API",
+                "{} SERVICE: Sent Request {{ command: {} }}",
+                self.service_name, command
+            );
 
         let rep: zeromq::ZmqMessage = self.socket.recv().await?;
         if let Some(reply) = rep.get(0) {
@@ -167,11 +168,12 @@ impl ReqProtocol {
 
             let reply: Reply = deserialize(&reply)?;
 
-            info!(
-                "{} SERVICE: Received Reply {{ error: {} }}",
-                self.service_name,
-                reply.has_error()
-            );
+            debug!(
+            target: "REQ PROTOCOL API",
+                    "{} SERVICE: Received Reply {{ error: {} }}",
+                    self.service_name,
+                    reply.has_error()
+                );
 
             if reply.has_error() {
                 // TODO return error status code instead of None
@@ -210,8 +212,9 @@ impl Publisher {
     pub async fn start(&mut self, recv_queue: async_channel::Receiver<Vec<u8>>) -> Result<()> {
         let addr = addr_to_string(self.addr);
         self.socket.bind(addr.as_str()).await?;
-        info!(
-            "{} PUBLISHER SERVICE : Bound To {}",
+        debug!(
+            target: "PUBLISHER API",
+            "{} SERVICE : Bound To {}",
             self.service_name, addr
         );
         loop {
@@ -248,8 +251,9 @@ impl Subscriber {
         self.socket.connect(addr.as_str()).await?;
 
         self.socket.subscribe("").await?;
-        info!(
-            "{} SUBSCRIBER SERVICE : Connected To {}",
+        debug!(
+            target: "SUBSCRIBER API",
+            "{} SERVICE : Connected To {}",
             self.service_name, addr
         );
         Ok(())

+ 11 - 14
src/wallet/cashierdb.rs

@@ -24,7 +24,7 @@ pub struct CashierDb {
 
 impl CashierDb {
     pub fn new(wallet: &str, password: String) -> Result<Self> {
-        debug!(target: "cashierdb", "new() Constructor called");
+        debug!(target: "CASHIERDB", "new() Constructor called");
         let path = join_config_path(&PathBuf::from(wallet))?;
         let cashier_secret = jubjub::Fr::random(&mut OsRng);
         let cashier_public = zcash_primitives::constants::SPENDING_KEY_GENERATOR * cashier_secret;
@@ -40,20 +40,18 @@ impl CashierDb {
         if !self.password.trim().is_empty() {
             let contents = include_str!("../../res/cashier.sql");
             let conn = Connection::open(&self.path)?;
-            debug!(target: "cashierdb", "OPENED CONNECTION AT PATH {:?}", self.path);
+            debug!(target: "CASHIERDB", "Opened connection at path {:?}", self.path);
             conn.pragma_update(None, "key", &self.password)?;
             conn.execute_batch(&contents)?;
         } else {
-            println!("Password is empty. You must set a password to use the wallet.");
-            println!("Current password: {}", self.password);
+            debug!(target: "CASHIERDB", "Password is empty. You must set a password to use the wallet.");
             return Err(Error::from(ClientFailed::EmptyPassword));
         }
         Ok(())
     }
 
     pub fn get_keys_by_dkey(&self, dkey_pub: &Vec<u8>) -> Result<()> {
-        println!("get keys...");
-        debug!(target: "CashierDB", "Check for existing dkey");
+        debug!(target: "CASHIERDB", "Check for existing dkey");
         //let dkey_id = self.get_value_deserialized(dkey_pub)?;
         // open connection
         let conn = Connection::open(&self.path)?;
@@ -82,7 +80,7 @@ impl CashierDb {
         btc_public: PubKey,
         //txid will be updated when exists
     ) -> Result<()> {
-        debug!(target: "CashierDB", "Put exchange keys");
+        debug!(target: "CASHIERDB", "Put exchange keys");
         // prepare the values
         //let dkey_pub = self.get_value_serialized(&dkey_pub)?;
         let btc_private = btc_private.to_bytes();
@@ -110,7 +108,7 @@ impl CashierDb {
         &self,
         btc_address: &Vec<u8>,
     ) -> Result<Option<(Vec<u8>, Vec<u8>)>> {
-        debug!(target: "CashierDB", "Check for existing btc address");
+        debug!(target: "CASHIERDB", "Check for existing btc address");
         // open connection
         let conn = Connection::open(&self.path)?;
         // unlock database
@@ -142,7 +140,7 @@ impl CashierDb {
         d_key_private: Vec<u8>,
         d_key_public: Vec<u8>,
     ) -> Result<()> {
-        debug!(target: "CashierDB", "Put withdraw keys");
+        debug!(target: "CASHIERDB", "Put withdraw keys");
 
         // open connection
         let conn = Connection::open(&self.path)?;
@@ -162,7 +160,7 @@ impl CashierDb {
     }
 
     pub fn cash_key_gen(&self) -> (Vec<u8>, Vec<u8>) {
-        debug!(target: "cash key_gen", "Generating cashier keys...");
+        debug!(target: "CASHIERDB", "Generating cashier keys...");
         let secret: jubjub::Fr = jubjub::Fr::random(&mut OsRng);
         let public = zcash_primitives::constants::SPENDING_KEY_GENERATOR * secret;
         let pubkey = serial::serialize(&public);
@@ -172,7 +170,6 @@ impl CashierDb {
 
     pub fn put_keypair(&self, key_public: Vec<u8>, key_private: Vec<u8>) -> Result<()> {
         let conn = Connection::open(&self.path)?;
-        println!("{}", self.password);
         conn.pragma_update(None, "key", &self.password)?;
         conn.execute(
             "INSERT INTO keys(key_public, key_private) VALUES (?1, ?2)",
@@ -182,7 +179,7 @@ impl CashierDb {
     }
 
     pub fn put_cashier_pub(&self, key_public: Vec<u8>) -> Result<()> {
-        debug!(target: "save_cash_key", "Save cashier keys...");
+        debug!(target: "CASHIERDB", "Save cashier keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         conn.execute(
@@ -193,7 +190,7 @@ impl CashierDb {
     }
 
     pub fn get_cashier_public(&self) -> Result<jubjub::SubgroupPoint> {
-        debug!(target: "get_cashier_public", "Returning keys...");
+        debug!(target: "CASHIERDB", "Returning keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         let mut stmt = conn.prepare("SELECT key_public FROM keys")?;
@@ -210,7 +207,7 @@ impl CashierDb {
         Ok(public)
     }
     pub fn get_cashier_private(&self) -> Result<jubjub::Fr> {
-        debug!(target: "get", "Returning keys...");
+        debug!(target: "CASHIERDB", "Returning keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         let mut stmt = conn.prepare("SELECT key_private FROM keys")?;

+ 8 - 17
src/wallet/walletdb.rs

@@ -30,7 +30,7 @@ pub struct WalletDb {
 
 impl WalletDb {
     pub fn new(path: &std::path::PathBuf, password: String) -> Result<Self> {
-        debug!(target: "walletdb", "new() Constructor called");
+        debug!(target: "WALLETDB", "new() Constructor called");
         let cashier_secret = jubjub::Fr::random(&mut OsRng);
         let secret = jubjub::Fr::random(&mut OsRng);
         let public = zcash_primitives::constants::SPENDING_KEY_GENERATOR * secret;
@@ -56,25 +56,16 @@ impl WalletDb {
         if !self.password.trim().is_empty() {
             let contents = include_str!("../../res/schema.sql");
             let conn = Connection::open(&self.path)?;
-            debug!(target: "walletdb", "OPENED CONNECTION AT PATH {:?}", self.path);
+            debug!(target: "WALLETDB", "OPENED CONNECTION AT PATH {:?}", self.path);
             conn.pragma_update(None, "key", &self.password)?;
             conn.execute_batch(&contents)?;
         } else {
-            info!("Password is empty. You must set a password to use the wallet.");
-            info!("Current password: {}", self.password);
+            debug!(target: "WALLETDB", "Password is empty. You must set a password to use the wallet.");
             return Err(Error::from(ClientFailed::EmptyPassword));
         }
         Ok(())
     }
 
-    pub fn init_cashier_db(&self) -> Result<()> {
-        let conn = Connection::open(&self.path)?;
-        debug!(target: "cashierdb", "OPENED CONNECTION AT PATH {:?}", self.path);
-        let contents = include_str!("../../res/schema.sql");
-        conn.execute_batch(&contents)?;
-        Ok(())
-    }
-
     pub fn get_own_coins(&self) -> Result<OwnCoins> {
         // open connection
         let conn = Connection::open(&self.path)?;
@@ -183,7 +174,7 @@ impl WalletDb {
     }
 
     pub fn key_gen(&self) -> (Vec<u8>, Vec<u8>) {
-        debug!(target: "key_gen", "Attempting to generate keys...");
+        debug!(target: "WALLETDB", "Attempting to generate keys...");
         let secret: jubjub::Fr = jubjub::Fr::random(&mut OsRng);
         let public = zcash_primitives::constants::SPENDING_KEY_GENERATOR * secret;
         let pubkey = serial::serialize(&public);
@@ -202,7 +193,7 @@ impl WalletDb {
     }
 
     pub fn put_cashier_pub(&self, key_public: Vec<u8>) -> Result<()> {
-        debug!(target: "save_cash_key", "Save cashier keys...");
+        debug!(target: "WALLETDB", "Save cashier keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         conn.execute(
@@ -213,7 +204,7 @@ impl WalletDb {
     }
 
     pub fn get_public(&self) -> Result<jubjub::SubgroupPoint> {
-        debug!(target: "get", "Returning keys...");
+        debug!(target: "WALLETDB", "Returning keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         let mut stmt = conn.prepare("SELECT key_public FROM keys")?;
@@ -233,7 +224,7 @@ impl WalletDb {
     }
 
     pub fn get_cashier_public(&self) -> Result<jubjub::SubgroupPoint> {
-        debug!(target: "get_cashier_public", "Returning keys...");
+        debug!(target: "WALLETDB", "Returning keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         let mut stmt = conn.prepare("SELECT key_public FROM cashier")?;
@@ -251,7 +242,7 @@ impl WalletDb {
     }
 
     pub fn get_private(&self) -> Result<jubjub::Fr> {
-        debug!(target: "get", "Returning keys...");
+        debug!(target: "WALLETDB", "Returning keys...");
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         let mut stmt = conn.prepare("SELECT key_private FROM keys")?;