|
@@ -151,7 +151,10 @@ class Block:
|
|
|
if prev is None:
|
|
if prev is None:
|
|
|
logging.warning("Previous block is missing in the block chain.")
|
|
logging.warning("Previous block is missing in the block chain.")
|
|
|
return False
|
|
return False
|
|
|
- if prev.height + chain.compute_difficulty(prev) != self.height:
|
|
|
|
|
|
|
+ if self.difficulty != chain.compute_difficulty(prev):
|
|
|
|
|
+ logging.warning("Block has wrong difficulty.")
|
|
|
|
|
+ return False
|
|
|
|
|
+ if prev.height + self.difficulty != self.height:
|
|
|
logging.warning("Block has wrong height.")
|
|
logging.warning("Block has wrong height.")
|
|
|
return False
|
|
return False
|
|
|
return True
|
|
return True
|