Skip to content

Commit 751182f

Browse files
committed
rm unused clones & arc
1 parent 9329574 commit 751182f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

script/bin/operator.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ where
159159
/// - If relaying the proof to any chain fails.
160160
async fn create_and_relay_proof(
161161
&self,
162-
chains: &[u64],
162+
chains: Vec<u64>,
163163
current_block: u64,
164164
target_block: u64,
165165
) -> Result<Vec<Result<()>>> {
@@ -179,15 +179,12 @@ where
179179
current_block, target_block
180180
))?;
181181

182-
// Put the proof in an Arc to avoid cloning it for each chain.
183-
let proof = Arc::new(proof);
184-
185182
// Relay to all the chains concurrently.
186-
let handles = chains.iter().map(|id| {
187-
let proof = proof.clone();
183+
let handles = chains.into_iter().map(|id| {
184+
let proof = &proof;
188185

189186
async move {
190-
match self.relay_header_range(&proof, *id).await {
187+
match self.relay_header_range(proof, id).await {
191188
Ok(tx_hash) => {
192189
info!(
193190
"Posted data commitment from block {} to block {}",
@@ -258,12 +255,11 @@ where
258255
});
259256

260257
let mut handles = Vec::new();
261-
let client = self.client.clone();
262258
for (last_known_block, ids) in blocks_to_chain_id {
263259
// If the consensus threshold is not met, the first block to match the threshold
264260
// will be used as the block to request.
265261
let block_to_request = find_block_to_request(
266-
&client,
262+
&self.client,
267263
last_known_block,
268264
block_update_interval,
269265
data_commitment_max,
@@ -283,7 +279,7 @@ where
283279
let operator_clone = self.clone();
284280
async move {
285281
operator_clone
286-
.create_and_relay_proof(&ids, last_known_block, block_to_request)
282+
.create_and_relay_proof(ids, last_known_block, block_to_request)
287283
.await
288284
}
289285
.instrument(tracing::span!(

0 commit comments

Comments
 (0)