From 537303ece320c0c6b71bf18de1552ff30bc357e5 Mon Sep 17 00:00:00 2001 From: Jakub Trnka Date: Tue, 6 Feb 2024 20:10:53 +0100 Subject: [PATCH] Remove needless clonning of Copy types - consequence of implementing Copy for secp256k1-keys types --- roles/jd-client/src/lib/downstream.rs | 4 ++-- roles/jd-client/src/main.rs | 12 ++++++------ roles/jd-server/src/lib/job_declarator/mod.rs | 8 ++++---- roles/mining-proxy/src/lib/mod.rs | 2 +- roles/pool/src/lib/mining_pool/mod.rs | 4 ++-- roles/pool/src/main.rs | 2 +- roles/translator/src/main.rs | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/roles/jd-client/src/lib/downstream.rs b/roles/jd-client/src/lib/downstream.rs index a89222a620..a453cea9ab 100644 --- a/roles/jd-client/src/lib/downstream.rs +++ b/roles/jd-client/src/lib/downstream.rs @@ -665,8 +665,8 @@ pub async fn listen_for_downstream_mining( if let Ok((stream, _)) = listner.accept().await { let responder = Responder::from_authority_kp( - &authority_public_key.clone().into_bytes(), - &authority_secret_key.clone().into_bytes(), + &authority_public_key.into_bytes(), + &authority_secret_key.into_bytes(), std::time::Duration::from_secs(cert_validity_sec), ) .unwrap(); diff --git a/roles/jd-client/src/main.rs b/roles/jd-client/src/main.rs index 4b11763a5e..9a6ba2dbe8 100644 --- a/roles/jd-client/src/main.rs +++ b/roles/jd-client/src/main.rs @@ -224,8 +224,8 @@ async fn initialize_jd_as_solo_miner( None, send_solution, proxy_config.withhold, - proxy_config.authority_public_key.clone(), - proxy_config.authority_secret_key.clone(), + proxy_config.authority_public_key, + proxy_config.authority_secret_key, proxy_config.cert_validity_sec, task_collector.clone(), status::Sender::Downstream(tx_status.clone()), @@ -288,7 +288,7 @@ async fn initialize_jd( // Instantiate a new `Upstream` (SV2 Pool) let upstream = match lib::upstream_sv2::Upstream::new( upstream_addr, - upstream_config.authority_pubkey.clone(), + upstream_config.authority_pubkey, 0, // TODO upstream_config.pool_signature.clone(), status::Sender::Upstream(tx_status.clone()), @@ -340,7 +340,7 @@ async fn initialize_jd( let port_jd = parts.next().unwrap().parse::().unwrap(); let jd = match JobDeclarator::new( SocketAddr::new(IpAddr::from_str(ip_jd.as_str()).unwrap(), port_jd), - upstream_config.authority_pubkey.clone().into_bytes(), + upstream_config.authority_pubkey.into_bytes(), proxy_config.clone(), upstream.clone(), task_collector.clone(), @@ -364,8 +364,8 @@ async fn initialize_jd( Some(upstream), send_solution, proxy_config.withhold, - proxy_config.authority_public_key.clone(), - proxy_config.authority_secret_key.clone(), + proxy_config.authority_public_key, + proxy_config.authority_secret_key, proxy_config.cert_validity_sec, task_collector.clone(), status::Sender::Downstream(tx_status.clone()), diff --git a/roles/jd-server/src/lib/job_declarator/mod.rs b/roles/jd-server/src/lib/job_declarator/mod.rs index 57d45c0276..602233ecea 100644 --- a/roles/jd-server/src/lib/job_declarator/mod.rs +++ b/roles/jd-server/src/lib/job_declarator/mod.rs @@ -59,8 +59,8 @@ impl JobDeclaratorDownstream { coinbase_output, token_to_job_map, tokens, - public_key: config.authority_public_key.clone(), - private_key: config.authority_secret_key.clone(), + public_key: config.authority_public_key, + private_key: config.authority_secret_key, mempool, declared_mining_job: None, tx_hash_list_hash: None, @@ -167,8 +167,8 @@ impl JobDeclarator { let listner = TcpListener::bind(&config.listen_jd_address).await.unwrap(); while let Ok((stream, _)) = listner.accept().await { let responder = Responder::from_authority_kp( - &config.authority_public_key.clone().into_bytes(), - &config.authority_secret_key.clone().into_bytes(), + &config.authority_public_key.into_bytes(), + &config.authority_secret_key.into_bytes(), std::time::Duration::from_secs(config.cert_validity_sec), ) .unwrap(); diff --git a/roles/mining-proxy/src/lib/mod.rs b/roles/mining-proxy/src/lib/mod.rs index 353799aca6..b9a9fd2f8d 100644 --- a/roles/mining-proxy/src/lib/mod.rs +++ b/roles/mining-proxy/src/lib/mod.rs @@ -120,7 +120,7 @@ pub async fn initialize_r_logic( let upstream = Arc::new(Mutex::new(UpstreamMiningNode::new( index as u32, socket, - upstream_.pub_key.clone().into_bytes(), + upstream_.pub_key.into_bytes(), upstream_.channel_kind, group_id.clone(), channel_ids.clone(), diff --git a/roles/pool/src/lib/mining_pool/mod.rs b/roles/pool/src/lib/mining_pool/mod.rs index 1b100ce892..a6d7309e2c 100644 --- a/roles/pool/src/lib/mining_pool/mod.rs +++ b/roles/pool/src/lib/mining_pool/mod.rs @@ -357,8 +357,8 @@ impl Pool { ); let responder = Responder::from_authority_kp( - &config.authority_public_key.clone().into_bytes(), - &config.authority_secret_key.clone().into_bytes(), + &config.authority_public_key.into_bytes(), + &config.authority_secret_key.into_bytes(), std::time::Duration::from_secs(config.cert_validity_sec), ); match responder { diff --git a/roles/pool/src/main.rs b/roles/pool/src/main.rs index 729fd5e64f..73280852c5 100644 --- a/roles/pool/src/main.rs +++ b/roles/pool/src/main.rs @@ -115,7 +115,7 @@ async fn main() { return; } }; - let authority_public_key = config.authority_public_key.clone(); + let authority_public_key = config.authority_public_key; let template_rx_res = TemplateRx::connect( config.tp_address.parse().unwrap(), s_new_t, diff --git a/roles/translator/src/main.rs b/roles/translator/src/main.rs index c155623088..84acbdbbaa 100644 --- a/roles/translator/src/main.rs +++ b/roles/translator/src/main.rs @@ -89,7 +89,7 @@ async fn main() { // Instantiate a new `Upstream` (SV2 Pool) let upstream = match upstream_sv2::Upstream::new( upstream_addr, - proxy_config.upstream_authority_pubkey.clone(), + proxy_config.upstream_authority_pubkey, rx_sv2_submit_shares_ext, tx_sv2_set_new_prev_hash, tx_sv2_new_ext_mining_job,