mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Printing difficulty while mining
This commit is contained in:
parent
eb2be99d40
commit
1ae2e905d8
2 changed files with 9 additions and 2 deletions
|
@ -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 {
|
impl Add<Difficulty> for Difficulty {
|
||||||
type Output = Difficulty;
|
type Output = Difficulty;
|
||||||
fn add(self, other: Difficulty) -> Difficulty {
|
fn add(self, other: Difficulty) -> Difficulty {
|
||||||
|
|
|
@ -74,9 +74,10 @@ impl Miner {
|
||||||
// transactions) and as long as the head hasn't changed
|
// transactions) and as long as the head hasn't changed
|
||||||
let deadline = time::get_time().sec + 2;
|
let deadline = time::get_time().sec + 2;
|
||||||
let mut sol = None;
|
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,
|
b.header.cuckoo_len,
|
||||||
latest_hash);
|
latest_hash,
|
||||||
|
b.header.difficulty);
|
||||||
let mut iter_count = 0;
|
let mut iter_count = 0;
|
||||||
while head.hash() == latest_hash && time::get_time().sec < deadline {
|
while head.hash() == latest_hash && time::get_time().sec < deadline {
|
||||||
let pow_hash = b.hash();
|
let pow_hash = b.hash();
|
||||||
|
|
Loading…
Reference in a new issue