diff --git a/Cargo.lock b/Cargo.lock index 2aeba29c..482cd173 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1392,9 +1392,9 @@ dependencies = [ [[package]] name = "drillx" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c5fd3a8f11a6420d6efb1952c8c2e788627cb2c9e834537dc4b6bd036461646" +checksum = "9f1b6097a8aeb360dc83cad60047b42cfabf54a56b81a75e254f5854211a7475" dependencies = [ "equix", "serde", @@ -2772,7 +2772,7 @@ dependencies = [ [[package]] name = "ore-cli" -version = "2.3.0" +version = "2.3.1" dependencies = [ "bincode", "bs58 0.5.1", diff --git a/Cargo.toml b/Cargo.toml index d908dc09..2a65a454 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ore-cli" -version = "2.3.0" +version = "2.3.1" edition = "2021" license = "Apache-2.0" description = "A command line interface for ORE cryptocurrency mining." @@ -27,7 +27,7 @@ chrono = "0.4.38" clap = { version = "4.4.12", features = ["derive"] } colored = "2.0" core_affinity = "0.8.1" -drillx = "2.0.0" +drillx = "2.1.0" futures = "0.3.30" indicatif = "0.17.8" num_cpus = "1.16.0" @@ -56,3 +56,15 @@ serde = { version = "1.0", features = ["derive"] } # ore-api = { path = "../ore/api" } # ore-utils = { path = "../ore/utils" } +[profile.release] +opt-level = 3 # Optimize for binary size. You can use "3" for full optimizations if binary size isn't an issue. +codegen-units = 1 # Better optimization with fewer codegen units +lto = true # Enable Link Time Optimization (LTO) +debug = false # Disable debug info to reduce binary size +panic = 'abort' # Reduces the binary size further by not including unwinding information +rpath = false +incremental = false +overflow-checks = false + +[build] +rustflags = ["-C", "target-cpu=native"] \ No newline at end of file diff --git a/src/mine.rs b/src/mine.rs index 5c369e3e..2d0b2061 100644 --- a/src/mine.rs +++ b/src/mine.rs @@ -124,23 +124,24 @@ impl Miner { let mut best_difficulty = 0; let mut best_hash = Hash::default(); loop { - // Create hash - if let Ok(hx) = drillx::hash_with_memory( + // Get hashes + let hxs = drillx::hashes_with_memory( &mut memory, &proof.challenge, &nonce.to_le_bytes(), - ) { + ); + + // Look for best difficulty score in all hashes + for hx in hxs { let difficulty = hx.difficulty(); if difficulty.gt(&best_difficulty) { best_nonce = nonce; best_difficulty = difficulty; best_hash = hx; - // {{ edit_1 }} if best_difficulty.gt(&*global_best_difficulty.read().unwrap()) { *global_best_difficulty.write().unwrap() = best_difficulty; } - // {{ edit_1 }} } } diff --git a/src/send_and_confirm.rs b/src/send_and_confirm.rs index 2c81ac33..2ac46cab 100644 --- a/src/send_and_confirm.rs +++ b/src/send_and_confirm.rs @@ -174,7 +174,7 @@ impl Miner { // Confirm transaction 'confirm: for _ in 0..CONFIRM_RETRIES { - std::thread::sleep(Duration::from_millis(CONFIRM_DELAY)); + tokio::time::sleep(Duration::from_millis(CONFIRM_DELAY)).await; match client.get_signature_statuses(&[sig]).await { Ok(signature_statuses) => { for status in signature_statuses.value { @@ -264,7 +264,7 @@ impl Miner { } // Retry - std::thread::sleep(Duration::from_millis(GATEWAY_DELAY)); + tokio::time::sleep(Duration::from_millis(GATEWAY_DELAY)).await; if attempts > GATEWAY_RETRIES { log_error(&progress_bar, "Max retries", true); return Err(ClientError { diff --git a/src/utils.rs b/src/utils.rs index 9326cc19..a932d2a7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -50,7 +50,7 @@ pub async fn get_updated_proof_with_authority( if proof.last_hash_at.gt(&lash_hash_at) { return proof; } - std::thread::sleep(Duration::from_millis(1000)); + tokio::time::sleep(Duration::from_millis(1_000)).await; } }