From dc840e156265fa61f00f20e3124d083ef4529221 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 16 Apr 2021 12:05:12 +1000 Subject: [PATCH] Take wallet names by reference We are always passing constants here. Make that more ergonomic. --- monero-harness/src/lib.rs | 2 +- monero-harness/tests/wallet.rs | 4 +--- swap/tests/harness/mod.rs | 10 ++++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/monero-harness/src/lib.rs b/monero-harness/src/lib.rs index 0824a44d..5f69cd43 100644 --- a/monero-harness/src/lib.rs +++ b/monero-harness/src/lib.rs @@ -56,7 +56,7 @@ impl<'c> Monero { /// miner wallet container name is: `miner` pub async fn new( cli: &'c Cli, - additional_wallets: Vec, + additional_wallets: Vec<&'static str>, ) -> Result<(Self, Vec>)> { let prefix = format!("{}_", random_prefix()); let monerod_name = format!("{}{}", prefix, MONEROD_DAEMON_CONTAINER_NAME); diff --git a/monero-harness/tests/wallet.rs b/monero-harness/tests/wallet.rs index d2e97cb4..df26d348 100644 --- a/monero-harness/tests/wallet.rs +++ b/monero-harness/tests/wallet.rs @@ -17,9 +17,7 @@ async fn fund_transfer_and_check_tx_key() { let send_to_bob = 5_000_000_000; let tc = Cli::default(); - let (monero, _containers) = Monero::new(&tc, vec!["alice".to_string(), "bob".to_string()]) - .await - .unwrap(); + let (monero, _containers) = Monero::new(&tc, vec!["alice", "bob"]).await.unwrap(); let alice_wallet = monero.wallet("alice").unwrap(); let bob_wallet = monero.wallet("bob").unwrap(); diff --git a/swap/tests/harness/mod.rs b/swap/tests/harness/mod.rs index 4888a4ce..58c77ea1 100644 --- a/swap/tests/harness/mod.rs +++ b/swap/tests/harness/mod.rs @@ -195,12 +195,10 @@ async fn init_monero_container( Monero, Vec>, ) { - let (monero, monerods) = Monero::new(&cli, vec![ - MONERO_WALLET_NAME_ALICE.to_owned(), - MONERO_WALLET_NAME_BOB.to_owned(), - ]) - .await - .unwrap(); + let (monero, monerods) = + Monero::new(&cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB]) + .await + .unwrap(); (monero, monerods) }