diff --git a/crates/tests-e2e/src/setup.rs b/crates/tests-e2e/src/setup.rs index 28338ab4d..6969ef0af 100644 --- a/crates/tests-e2e/src/setup.rs +++ b/crates/tests-e2e/src/setup.rs @@ -57,14 +57,20 @@ impl TestSetup { } } - pub async fn fund_coordinator(&self, amount: Amount) { + /// Funds the coordinator with [`amount`/`in_utxos`] utxos + /// + /// E.g. if amount = 3 BTC, and in_utxos = 3, it would create 3 UTXOs a 1 BTC + pub async fn fund_coordinator(&self, amount: Amount, in_utxos: u64) { // Ensure that the coordinator has a free UTXO available. let address = self.coordinator.get_new_address().await.unwrap(); - self.bitcoind - .send_to_address(&address, amount) - .await - .unwrap(); + let sats_per_fund = amount.to_sat() / in_utxos; + for _ in 0..in_utxos { + self.bitcoind + .send_to_address(&address, Amount::from_sat(sats_per_fund)) + .await + .unwrap(); + } self.bitcoind.mine(1).await.unwrap(); @@ -99,7 +105,7 @@ impl TestSetup { pub async fn new_after_funding() -> Self { let setup = Self::new().await; - setup.fund_coordinator(Amount::ONE_BTC).await; + setup.fund_coordinator(Amount::ONE_BTC, 2).await; setup.fund_app(Amount::ONE_BTC).await; diff --git a/crates/tests-e2e/tests/e2e_open_position_small_utxos.rs b/crates/tests-e2e/tests/e2e_open_position_small_utxos.rs index 86e23e58d..0d2f87f2c 100644 --- a/crates/tests-e2e/tests/e2e_open_position_small_utxos.rs +++ b/crates/tests-e2e/tests/e2e_open_position_small_utxos.rs @@ -19,7 +19,7 @@ async fn can_open_position_with_multiple_small_utxos() { let setup = TestSetup::new().await; - setup.fund_coordinator(Amount::ONE_BTC).await; + setup.fund_coordinator(Amount::ONE_BTC, 2).await; let app = &setup.app; diff --git a/crates/tests-e2e/tests/e2e_reject_offer.rs b/crates/tests-e2e/tests/e2e_reject_offer.rs index 8f1e0890c..e63419f74 100644 --- a/crates/tests-e2e/tests/e2e_reject_offer.rs +++ b/crates/tests-e2e/tests/e2e_reject_offer.rs @@ -15,7 +15,7 @@ use tokio::task::spawn_blocking; #[ignore = "need to be run with 'just e2e' command"] async fn reject_offer() { let test = TestSetup::new().await; - test.fund_coordinator(Amount::ONE_BTC).await; + test.fund_coordinator(Amount::ONE_BTC, 2).await; test.fund_app(Amount::from_sat(250_000)).await; let app = &test.app;