Fixed issue #65.

This commit is contained in:
egglang 2018-02-08 21:08:09 +09:00
parent 250a01c83e
commit b317e41769
1 changed files with 3 additions and 2 deletions

View File

@ -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