diff --git a/monero-harness/src/image.rs b/monero-harness/src/image.rs index 4d699fc9..a491a345 100644 --- a/monero-harness/src/image.rs +++ b/monero-harness/src/image.rs @@ -245,8 +245,6 @@ impl MonerodArgs { args.push(format!("--log-level {}", self.log_level)); } - // args.push(format!("--disable-rpc-login")); - args.join(" ") } } diff --git a/monero-harness/src/lib.rs b/monero-harness/src/lib.rs index b51f6e81..98e9c01e 100644 --- a/monero-harness/src/lib.rs +++ b/monero-harness/src/lib.rs @@ -119,7 +119,7 @@ impl<'c> Monero { // generate the first 70 as bulk let monerod = &self.monerod; - let block = monerod.inner().generate_blocks(70, &miner_address).await?; + let block = monerod.client().generate_blocks(70, &miner_address).await?; tracing::info!("Generated {:?} blocks", block); miner_wallet.refresh().await?; @@ -129,7 +129,7 @@ impl<'c> Monero { let address = wallet.address().await?.address; miner_wallet.transfer(&address, *amount).await?; tracing::info!("Funded {} wallet with {}", wallet.name, amount); - monerod.inner().generate_blocks(10, &miner_address).await?; + monerod.client().generate_blocks(10, &miner_address).await?; wallet.refresh().await?; } } @@ -137,7 +137,7 @@ impl<'c> Monero { monerod.start_miner(&miner_address).await?; tracing::info!("Waiting for miner wallet to catch up..."); - let block_height = monerod.inner().get_block_count().await?; + let block_height = monerod.client().get_block_count().await?; miner_wallet .wait_for_wallet_height(block_height) .await @@ -190,14 +190,14 @@ impl<'c> Monerod { )) } - pub fn inner(&self) -> monerod::Client { + pub fn client(&self) -> monerod::Client { monerod::Client::localhost(self.rpc_port) } /// Spawns a task to mine blocks in a regular interval to the provided /// address pub async fn start_miner(&self, miner_wallet_address: &str) -> Result<()> { - let monerod = self.inner(); + let monerod = self.client(); let _ = tokio::spawn(mine(monerod, miner_wallet_address.to_string())); Ok(()) } @@ -242,14 +242,14 @@ impl<'c> MoneroWalletRpc { )) } - pub fn inner(&self) -> wallet::Client { + pub fn client(&self) -> wallet::Client { wallet::Client::localhost(self.rpc_port) } // It takes a little while for the wallet to sync with monerod. pub async fn wait_for_wallet_height(&self, height: u32) -> Result<()> { let mut retry: u8 = 0; - while self.inner().block_height().await?.height < height { + while self.client().block_height().await?.height < height { if retry >= 30 { // ~30 seconds bail!("Wallet could not catch up with monerod after 30 retries.") @@ -262,20 +262,20 @@ impl<'c> MoneroWalletRpc { /// Sends amount to address pub async fn transfer(&self, address: &str, amount: u64) -> Result { - self.inner().transfer(0, amount, address).await + self.client().transfer(0, amount, address).await } pub async fn address(&self) -> Result { - self.inner().get_address(0).await + self.client().get_address(0).await } pub async fn balance(&self) -> Result { - self.inner().refresh().await?; - self.inner().get_balance(0).await + self.client().refresh().await?; + self.client().get_balance(0).await } pub async fn refresh(&self) -> Result { - self.inner().refresh().await + self.client().refresh().await } } /// Mine a block ever BLOCK_TIME_SECS seconds. diff --git a/monero-harness/tests/monerod.rs b/monero-harness/tests/monerod.rs index f081c4b4..35f12744 100644 --- a/monero-harness/tests/monerod.rs +++ b/monero-harness/tests/monerod.rs @@ -20,7 +20,7 @@ async fn init_miner_and_mine_to_miner_address() { time::delay_for(Duration::from_millis(1010)).await; // after a bit more than 1 sec another block should have been mined - let block_height = monerod.inner().get_block_count().await.unwrap(); + let block_height = monerod.client().get_block_count().await.unwrap(); assert_that(&block_height).is_greater_than(70); } diff --git a/monero-harness/tests/wallet.rs b/monero-harness/tests/wallet.rs index 17d70030..44fc6ec5 100644 --- a/monero-harness/tests/wallet.rs +++ b/monero-harness/tests/wallet.rs @@ -41,7 +41,7 @@ async fn fund_transfer_and_check_tx_key() { monero .monerod() - .inner() + .client() .generate_blocks(10, &miner_address) .await .unwrap(); @@ -54,7 +54,7 @@ async fn fund_transfer_and_check_tx_key() { let tx_id = transfer.tx_hash; let tx_key = transfer.tx_key; let res = bob_wallet - .inner() + .client() .check_tx_key(&tx_id, &tx_key, &bob_address) .await .expect("failed to check tx by key"); diff --git a/xmr-btc/tests/harness/mod.rs b/xmr-btc/tests/harness/mod.rs index c80d02ad..3d789b8f 100644 --- a/xmr-btc/tests/harness/mod.rs +++ b/xmr-btc/tests/harness/mod.rs @@ -135,8 +135,8 @@ pub async fn init_test( .await .unwrap(); - let alice_monero_wallet = wallet::monero::Wallet(monero.wallet("alice").unwrap().inner()); - let bob_monero_wallet = wallet::monero::Wallet(monero.wallet("bob").unwrap().inner()); + let alice_monero_wallet = wallet::monero::Wallet(monero.wallet("alice").unwrap().client()); + let bob_monero_wallet = wallet::monero::Wallet(monero.wallet("bob").unwrap().client()); let alice_btc_wallet = wallet::bitcoin::Wallet::new("alice", &bitcoind.node_url) .await