diff --git a/swap/src/monero.rs b/swap/src/monero.rs index b3c9c51a..e400be22 100644 --- a/swap/src/monero.rs +++ b/swap/src/monero.rs @@ -229,8 +229,8 @@ pub trait CreateWalletForOutput { } #[async_trait] -pub trait CreateWalletForOutputThenLoadDefaultWallet { - async fn create_and_load_wallet_for_output_then_load_default_wallet( +pub trait CreateWalletForOutputThenReloadWallet { + async fn create_and_load_wallet_for_output_then_reload_wallet( &self, private_spend_key: PrivateKey, private_view_key: PrivateViewKey, diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index cc79a250..f8e5c2eb 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -1,5 +1,5 @@ use crate::monero::{ - Amount, CreateWallet, CreateWalletForOutput, CreateWalletForOutputThenLoadDefaultWallet, + Amount, CreateWallet, CreateWalletForOutput, CreateWalletForOutputThenReloadWallet, InsufficientFunds, OpenWallet, PrivateViewKey, PublicViewKey, Transfer, TransferProof, TxHash, WatchForTransfer, }; @@ -21,27 +21,23 @@ use url::Url; pub struct Wallet { inner: Mutex, network: Network, - default_wallet_name: String, + name: String, } impl Wallet { - pub fn new(url: Url, network: Network, default_wallet_name: String) -> Self { + pub fn new(url: Url, network: Network, name: String) -> Self { Self { inner: Mutex::new(wallet::Client::new(url)), network, - default_wallet_name, + name, } } - pub fn new_with_client( - client: wallet::Client, - network: Network, - default_wallet_name: String, - ) -> Self { + pub fn new_with_client(client: wallet::Client, network: Network, name: String) -> Self { Self { inner: Mutex::new(client), network, - default_wallet_name, + name, } } @@ -133,8 +129,8 @@ impl CreateWalletForOutput for Wallet { } #[async_trait] -impl CreateWalletForOutputThenLoadDefaultWallet for Wallet { - async fn create_and_load_wallet_for_output_then_load_default_wallet( +impl CreateWalletForOutputThenReloadWallet for Wallet { + async fn create_and_load_wallet_for_output_then_reload_wallet( &self, private_spend_key: PrivateKey, private_view_key: PrivateViewKey, @@ -156,9 +152,7 @@ impl CreateWalletForOutputThenLoadDefaultWallet for Wallet { ) .await?; - let _ = wallet - .open_wallet(self.default_wallet_name.as_str()) - .await?; + let _ = wallet.open_wallet(self.name.as_str()).await?; Ok(()) } @@ -170,7 +164,7 @@ impl OpenWallet for Wallet { self.inner .lock() .await - .open_wallet(self.default_wallet_name.as_str()) + .open_wallet(self.name.as_str()) .await?; Ok(()) } @@ -182,7 +176,7 @@ impl CreateWallet for Wallet { self.inner .lock() .await - .create_wallet(self.default_wallet_name.as_str()) + .create_wallet(self.name.as_str()) .await?; Ok(()) } diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index addde0a4..4b13dff1 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -7,7 +7,7 @@ use crate::{ database::Database, execution_params::ExecutionParams, monero, - monero::CreateWalletForOutputThenLoadDefaultWallet, + monero::CreateWalletForOutputThenReloadWallet, monero_ext::ScalarExt, protocol::{ alice, @@ -392,7 +392,7 @@ async fn run_until_internal( let view_key = state3.v; monero_wallet - .create_and_load_wallet_for_output_then_load_default_wallet( + .create_and_load_wallet_for_output_then_reload_wallet( spend_key, view_key, monero_wallet_restore_blockheight,