commit
2d995664bb
|
@ -51,11 +51,12 @@ class Blockchain:
|
|||
print(f'{block}')
|
||||
print("\n-----------\n")
|
||||
# Check that the hash of the block is correct
|
||||
if block['previous_hash'] != self.hash(last_block):
|
||||
last_block_hash = self.hash(last_block)
|
||||
if block['previous_hash'] != last_block_hash:
|
||||
return False
|
||||
|
||||
# Check that the Proof of Work is correct
|
||||
if not self.valid_proof(last_block['proof'], block['proof'], last_block['previous_hash']):
|
||||
if not self.valid_proof(last_block['proof'], block['proof'], last_block_hash):
|
||||
return False
|
||||
|
||||
last_block = block
|
||||
|
|
Loading…
Reference in New Issue