Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions chapters/chapter_4/full_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def new_block(self):
block_hash = self.hash(block)
block["hash"] = block_hash

# Reset the list of pending transactions
self.pending_transactions = []

return block

@staticmethod
Expand All @@ -54,5 +51,8 @@ def proof_of_work(self):
if self.valid_block(new_block):
break

# Reset the list of pending transactions
self.pending_transactions = []

self.chain.append(new_block)
print("Found a new block: ", new_block)
6 changes: 3 additions & 3 deletions chapters/chapter_6/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ def new_block(self):
block_hash = self.hash(block)
block["hash"] = block_hash

# Reset the list of pending transactions
self.pending_transactions = []

return block

@staticmethod
Expand Down Expand Up @@ -90,6 +87,9 @@ async def proof_of_work(self):

await asyncio.sleep(0)

# Reset the list of pending transactions
self.pending_transactions = []

self.chain.append(new_block)
print("Found a new block: ", new_block)

Expand Down
6 changes: 3 additions & 3 deletions chapters/chapter_7/funcoin/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def new_block(self):
timestamp=time(),
)

# Reset the list of pending transactions
self.pending_transactions = []

return block

@staticmethod
Expand Down Expand Up @@ -113,5 +110,8 @@ async def mine_new_block(self):

await asyncio.sleep(0)

# Reset the list of pending transactions
self.pending_transactions = []

self.chain.append(new_block)
logger.info("Found a new block: ", new_block)