diff --git a/src/wallet/cashierdb.rs b/src/wallet/cashierdb.rs index 0ad309144..9c64cce80 100644 --- a/src/wallet/cashierdb.rs +++ b/src/wallet/cashierdb.rs @@ -344,7 +344,6 @@ mod tests { assert_eq!(addr.is_none(), true); - wallet.destroy()?; std::fs::remove_file(walletdb_path)?; Ok(()) diff --git a/src/wallet/wallet_api.rs b/src/wallet/wallet_api.rs index 41b7f0bb2..3c709c2f0 100644 --- a/src/wallet/wallet_api.rs +++ b/src/wallet/wallet_api.rs @@ -1,8 +1,6 @@ use crate::serial::{deserialize, serialize, Decodable, Encodable}; use crate::Result; -use rusqlite::Connection; - use std::path::PathBuf; pub trait WalletApi { @@ -19,32 +17,4 @@ pub trait WalletApi { let v: D = deserialize(&key)?; Ok(v) } - - fn get_tables_name(&self) -> Result> { - let conn = Connection::open(&self.get_path())?; - conn.pragma_update(None, "key", &self.get_password())?; - let mut stmt = conn.prepare("SELECT name FROM sqlite_master WHERE type='table'")?; - let table_iter = stmt.query_map::([], |row| row.get(0))?; - - let mut tables = Vec::new(); - - for table in table_iter { - tables.push(table?); - } - - Ok(tables) - } - - fn destroy(&self) -> Result<()> { - let conn = Connection::open(&self.get_path())?; - conn.pragma_update(None, "key", &self.get_password())?; - - for table in self.get_tables_name()?.iter() { - let drop_stmt = format!("DROP TABLE IF EXISTS {}", table); - let drop_stmt = drop_stmt.as_str(); - conn.execute(drop_stmt, [])?; - } - - Ok(()) - } } diff --git a/src/wallet/walletdb.rs b/src/wallet/walletdb.rs index 13a8d814f..b937eec1f 100644 --- a/src/wallet/walletdb.rs +++ b/src/wallet/walletdb.rs @@ -310,7 +310,6 @@ mod tests { assert_eq!(public, keypair.public); assert_eq!(secret, keypair.private); - wallet.destroy()?; std::fs::remove_file(walletdb_path)?; Ok(()) @@ -360,7 +359,6 @@ mod tests { assert_eq!(own_coin.witness.root(), witness.root()); assert_eq!(own_coin.witness.path(), witness.path()); - wallet.destroy()?; std::fs::remove_file(walletdb_path)?; Ok(()) @@ -425,7 +423,6 @@ mod tests { assert_eq!(tree.root(), witness.root()); } - wallet.destroy()?; std::fs::remove_file(walletdb_path)?; Ok(())