Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
223880 committed Jun 28, 2024
1 parent 067120c commit c08ba8c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/mining/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
+++ mining/lib.rs
-use std::collections::HashMap;
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};

pub struct Miner {
pub id: usize,
pub struct Miner {
pub hash_power: usize,
pub hash_rate: AtomicUsize,
pub shares: Arc<HashMap<usize, usize>>,
- pub difficulty: usize,
+ pub difficulty: u64,
pub difficulty: usize,
pub difficulty: u64,
}
}

Expand All @@ -25,20 +24,20 @@ use std::collections::HashMap;
}

pub fn hash_rate(&self) -> usize {
- self.hash_rate.load(Ordering::SeqCst)
+ self.hash_rate.load(Ordering::SeqCst) as u64
- self.hash_rate.load(Ordering::SeqCst)
self.hash_rate.load(Ordering::SeqCst) as u64
}

pub fn mine(&self, nonce: usize) -> bool {

let mut hash = nonce;
@@ impl Miner {
impl Miner {
self.hash_rate.store(hash_rate, Ordering::SeqCst);
true

} else {
- false
+ false
false
false
}

}
Expand Down

0 comments on commit c08ba8c

Please sign in to comment.