Printing difficulty while mining

This commit is contained in:
Ignotus Peverell 2017-05-25 17:42:29 -07:00
parent eb2be99d40
commit 1ae2e905d8
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
2 changed files with 9 additions and 2 deletions

View file

@ -68,6 +68,12 @@ impl Difficulty {
}
}
impl fmt::Display for Difficulty {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.num)
}
}
impl Add<Difficulty> for Difficulty {
type Output = Difficulty;
fn add(self, other: Difficulty) -> Difficulty {

View file

@ -74,9 +74,10 @@ impl Miner {
// transactions) and as long as the head hasn't changed
let deadline = time::get_time().sec + 2;
let mut sol = None;
debug!("Mining at Cuckoo{} for at most 2 secs on block {}.",
debug!("Mining at Cuckoo{} for at most 2 secs on block {} at difficulty {}.",
b.header.cuckoo_len,
latest_hash);
latest_hash,
b.header.difficulty);
let mut iter_count = 0;
while head.hash() == latest_hash && time::get_time().sec < deadline {
let pow_hash = b.hash();