From 672728610c7c52dcb4dcecd38a8951c12efeea94 Mon Sep 17 00:00:00 2001 From: jfldde <168934971+jfldde@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:51:22 +0000 Subject: [PATCH] Create wallet for every bitcoin node --- src/bitcoin.rs | 4 ++++ src/framework.rs | 32 +++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/bitcoin.rs b/src/bitcoin.rs index dea6065..51559e5 100644 --- a/src/bitcoin.rs +++ b/src/bitcoin.rs @@ -350,6 +350,10 @@ impl BitcoinNodeCluster { pub fn get_mut(&mut self, index: usize) -> Option<&mut BitcoinNode> { self.inner.get_mut(index) } + + pub fn iter(&self) -> std::slice::Iter<'_, BitcoinNode> { + self.inner.iter() + } } async fn wait_for_rpc_ready(client: &Client, timeout: Option) -> Result<()> { diff --git a/src/framework.rs b/src/framework.rs index 1404163..d782157 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -222,22 +222,24 @@ impl TestFramework { } pub async fn fund_da_wallets(&mut self) -> Result<()> { - let da = self.bitcoin_nodes.get(0).unwrap(); - - da.create_wallet(&NodeKind::Sequencer.to_string(), None, None, None, None) - .await?; - da.create_wallet(&NodeKind::BatchProver.to_string(), None, None, None, None) - .await?; - da.create_wallet( - &NodeKind::LightClientProver.to_string(), - None, - None, - None, - None, - ) - .await?; - da.create_wallet(&NodeKind::Bitcoin.to_string(), None, None, None, None) + for da in self.bitcoin_nodes.iter() { + da.create_wallet(&NodeKind::Sequencer.to_string(), None, None, None, None) + .await?; + da.create_wallet(&NodeKind::BatchProver.to_string(), None, None, None, None) + .await?; + da.create_wallet( + &NodeKind::LightClientProver.to_string(), + None, + None, + None, + None, + ) .await?; + da.create_wallet(&NodeKind::Bitcoin.to_string(), None, None, None, None) + .await?; + } + + let da = self.bitcoin_nodes.get(0).unwrap(); let blocks_to_mature = 100; let blocks_to_fund = 25;