Skip to content

Commit

Permalink
Merge pull request #96 from KOSASIH/deepsource-transform-292ab0ef
Browse files Browse the repository at this point in the history
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
  • Loading branch information
KOSASIH authored May 10, 2024
2 parents 3ee504a + fa3d238 commit fdee07a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions blockchain/miner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import time

from blockchain.block import Blockchain


class Miner:
def __init__(self, blockchain):
self.blockchain = blockchain
Expand All @@ -9,12 +11,12 @@ def mine_block(self, data):
while True:
if self.blockchain.is_chain_valid(self.blockchain.chain):
self.blockchain.add_block(data)
print('Block successfully mined!')
print('Proof of work: {}'.format(self.blockchain.chain[-1].hash))
print("Block successfully mined!")
print("Proof of work: {}".format(self.blockchain.chain[-1].hash))
break
else:
print('Block not mined. Invalid chain.')
print("Block not mined. Invalid chain.")
self.blockchain.chain = [self.blockchain.create_genesis_block()]
self.blockchain.difficulty += 1
print('New difficulty: {}'.format(self.blockchain.difficulty))
print("New difficulty: {}".format(self.blockchain.difficulty))
time.sleep(1)

0 comments on commit fdee07a

Please sign in to comment.