Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change interpolation to format #197

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def valid_chain(self, chain):

while current_index < len(chain):
block = chain[current_index]
print(f'{last_block}')
print(f'{block}')
print('{}'.format(last_block))
print('{}'.format(block))
print("\n-----------\n")
# Check that the hash of the block is correct
last_block_hash = self.hash(last_block)
Expand Down Expand Up @@ -80,8 +80,7 @@ def resolve_conflicts(self):

# Grab and verify the chains from all the nodes in our network
for node in neighbours:
response = requests.get(f'http://{node}/chain')

response = requests.get('http://{0}/chain'.format(node))
if response.status_code == 200:
length = response.json()['length']
chain = response.json()['chain']
Expand Down Expand Up @@ -186,7 +185,7 @@ def valid_proof(last_proof, proof, last_hash):

"""

guess = f'{last_proof}{proof}{last_hash}'.encode()
guess = '{0}{1}{2}'.format(last_proof,proof,last_hash).encode()
guess_hash = hashlib.sha256(guess).hexdigest()
return guess_hash[:4] == "0000"

Expand Down Expand Up @@ -241,7 +240,7 @@ def new_transaction():
# Create a new Transaction
index = blockchain.new_transaction(values['sender'], values['recipient'], values['amount'])

response = {'message': f'Transaction will be added to Block {index}'}
response = {'message' :'Transaction will be added to Block {}'.format(index)}
return jsonify(response), 201


Expand Down