|
|
@@ -20,17 +20,19 @@ class Block:
|
|
|
return CURRENT
|
|
|
|
|
|
def __init__(self, previous=None):
|
|
|
- self.proof = None
|
|
|
self.previous_hash = previous.hash_value if previous is not None else None
|
|
|
self.transactions = []
|
|
|
self.hash_value = None
|
|
|
self.locked = False
|
|
|
self.timestamp = 0
|
|
|
self.height = previous.height + 1 if previous is not None else 0
|
|
|
+ self.nonce = self.height
|
|
|
|
|
|
def add_hashed_transaction(self, hashed: str):
|
|
|
- self.transactions.append(hashed)
|
|
|
- self.log(f'Transaction added: {hashed}')
|
|
|
+ trans = Transaction()
|
|
|
+ trans.from_serialized(hashed)
|
|
|
+ self.transactions.append(trans)
|
|
|
+ self.log(f'Hashed transaction added: {hashed}')
|
|
|
return True
|
|
|
|
|
|
def add_transaction(self, trans: Transaction):
|