Skip to content

Commit

Permalink
Remove needless clonning of Copy types
Browse files Browse the repository at this point in the history
- consequence of implementing Copy for secp256k1-keys types
  • Loading branch information
jakubtrnka committed Feb 6, 2024
1 parent 669a5f1 commit b6af360
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions roles/jd-client/src/lib/downstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions roles/jd-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -340,7 +340,7 @@ async fn initialize_jd(
let port_jd = parts.next().unwrap().parse::<u16>().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(),
Expand All @@ -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()),
Expand Down
8 changes: 4 additions & 4 deletions roles/jd-server/src/lib/job_declarator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion roles/mining-proxy/src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions roles/pool/src/lib/mining_pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion roles/pool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion roles/translator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b6af360

Please sign in to comment.