diff options
Diffstat (limited to 'src/blocks.rs')
| -rw-r--r-- | src/blocks.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/blocks.rs b/src/blocks.rs index 758fe71..288e754 100644 --- a/src/blocks.rs +++ b/src/blocks.rs @@ -42,9 +42,9 @@ impl Block { unreachable!() } - pub fn verify_pow(&mut self, pow: u64) -> bool { + pub fn verify_pow(&mut self) -> bool { let mut hasher = DefaultHasher::new(); - (&self.prev_hash, &self.trans, pow).hash(&mut hasher); + self.hash(&mut hasher); hasher .finish() .to_string() @@ -66,15 +66,9 @@ impl Hash for Block { .hash(state); self.trans .hash(state); - if self - .pow - .is_none() - { - Self::calc_pow(self).hash(state); - } else { - self.pow - .hash(state); - } + self.pow + .expect("Cannot hash whole block with no PoW") + .hash(state); } } |
