From b317e417694c6616699c859c08b2895b677dc154 Mon Sep 17 00:00:00 2001 From: egglang Date: Thu, 8 Feb 2018 21:08:09 +0900 Subject: [PATCH] Fixed issue #65. --- blockchain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blockchain.py b/blockchain.py index 9de43dd..937d352 100644 --- a/blockchain.py +++ b/blockchain.py @@ -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