Merge pull request #68 from egglang/master

Fixed issue #65.
This commit is contained in:
Daniel van Flymen 2018-04-27 01:54:52 -04:00 committed by GitHub
commit 2d995664bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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