Fix failing test due to uninitialized miner

This commit is contained in:
Philipp Hoenisch 2020-11-03 11:00:05 +11:00
parent 0b9e8c145e
commit a04f04f1a5
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
2 changed files with 9 additions and 9 deletions

View File

@ -121,12 +121,6 @@ impl<'c> Monero {
let miner_wallet = self.wallet("miner")?;
let miner_address = miner_wallet.address().await?.address;
let alice_wallet = self.wallet("alice")?;
let alice_address = alice_wallet.address().await?.address;
let bob_wallet = self.wallet("bob")?;
let bob_address = bob_wallet.address().await?.address;
// generate the first 70 as bulk
let monerod = &self.monerod;
let block = monerod.inner().generate_blocks(70, &miner_address).await?;
@ -134,17 +128,22 @@ impl<'c> Monero {
miner_wallet.refresh().await?;
if alice_amount > 0 {
let alice_wallet = self.wallet("alice")?;
let alice_address = alice_wallet.address().await?.address;
miner_wallet.transfer(&alice_address, alice_amount).await?;
tracing::info!("Funded alice wallet with {}", alice_amount);
monerod.inner().generate_blocks(10, &miner_address).await?;
alice_wallet.refresh().await?;
}
if bob_amount > 0 {
let bob_wallet = self.wallet("bob")?;
let bob_address = bob_wallet.address().await?.address;
miner_wallet.transfer(&bob_address, bob_amount).await?;
tracing::info!("Funded bob wallet with {}", bob_amount);
monerod.inner().generate_blocks(10, &miner_address).await?;
bob_wallet.refresh().await?;
}
monerod.inner().generate_blocks(10, &miner_address).await?;
alice_wallet.refresh().await?;
bob_wallet.refresh().await?;
monerod.start_miner(&miner_address).await?;
tracing::info!("Waiting for miner wallet to catch up...");

View File

@ -9,6 +9,7 @@ async fn init_miner_and_mine_to_miner_address() {
let tc = Cli::default();
let (monero, _monerod_container) = Monero::new(&tc, None, None, vec![]).await.unwrap();
monero.init(0, 0).await.unwrap();
let monerod = monero.monerod();
let miner_wallet = monero.wallet("miner").unwrap();