From 5b798217bcc00a404c1af0f5e3e66b7333f17c81 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Tue, 2 Mar 2021 19:35:55 +1100 Subject: [PATCH] Open means opening the current wallet --- swap/src/bin/asb.rs | 2 +- swap/src/bin/swap_cli.rs | 4 +--- swap/src/monero.rs | 2 +- swap/src/monero/wallet.rs | 8 ++++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 488aade3..26920365 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -165,7 +165,7 @@ async fn init_wallets( ); // Setup the Monero wallet - let open_wallet_response = monero_wallet.open_wallet(DEFAULT_WALLET_NAME).await; + let open_wallet_response = monero_wallet.open().await; if open_wallet_response.is_err() { monero_wallet .create_wallet(DEFAULT_WALLET_NAME) diff --git a/swap/src/bin/swap_cli.rs b/swap/src/bin/swap_cli.rs index ad6c74dd..0834151c 100644 --- a/swap/src/bin/swap_cli.rs +++ b/swap/src/bin/swap_cli.rs @@ -293,9 +293,7 @@ async fn init_monero_wallet( ); // Setup the temporary Monero wallet necessary for monitoring the blockchain - let open_monitoring_wallet_response = monero_wallet - .open_wallet(MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME) - .await; + let open_monitoring_wallet_response = monero_wallet.open().await; if open_monitoring_wallet_response.is_err() { monero_wallet .create_wallet(MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME) diff --git a/swap/src/monero.rs b/swap/src/monero.rs index 90224948..00056c2e 100644 --- a/swap/src/monero.rs +++ b/swap/src/monero.rs @@ -240,7 +240,7 @@ pub trait CreateWalletForOutputThenLoadDefaultWallet { #[async_trait] pub trait OpenWallet { - async fn open_wallet(&self, file_name: &str) -> Result<()>; + async fn open(&self) -> Result<()>; } #[async_trait] diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index b79ced60..202b7185 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -166,8 +166,12 @@ impl CreateWalletForOutputThenLoadDefaultWallet for Wallet { #[async_trait] impl OpenWallet for Wallet { - async fn open_wallet(&self, file_name: &str) -> Result<()> { - self.inner.lock().await.open_wallet(file_name).await?; + async fn open(&self) -> Result<()> { + self.inner + .lock() + .await + .open_wallet(self.default_wallet_name.as_str()) + .await?; Ok(()) } }