} pub(crate) async fn get_transactions(&self, txids: Vec) -> Result> { if txids.is_empty() { return Ok(Vec::new()); } let mut reqs = Vec::with_capacity(txids.len()); for (i, txid) in txids.iter().enumerate() { let req = json!({ "jsonrpc": "2.0", "id": i, // Use the index as id, so we can quickly sort the response "method": "getrawtransaction", "params": [ txid ] }); reqs.push(req); } let body = Value::Array(reqs).to_string(); let mut results: Vec>; let mut retries = 0; loop { results = match self.try_get_transactions(body.clone()).await { Ok(results) => results, Err(error) => { if retries >= 5 { return Err(anyhow!( "failed to fetch raw transactions after 5 retries: {}", error )); } log::info!("failed to fetch raw transactions, retrying: {}", error); tokio::time::sleep(tokio::time::Duration::from_millis(