Allow clients to transmit payments
This commit is contained in:
@@ -232,7 +232,7 @@ class OpenTransactions:
|
||||
used_transaction_ids = latest_block.used_transaction_ids.copy()
|
||||
balances = latest_block.balances.copy()
|
||||
def is_valid(transaction):
|
||||
sender_tuple = (transaction.sender, transation.id)
|
||||
sender_tuple = (transaction.sender, transaction.id)
|
||||
if sender_tuple in used_transaction_ids:
|
||||
return False
|
||||
balance = balances.get(transaction.sender) or 0
|
||||
@@ -254,7 +254,7 @@ class OpenTransactions:
|
||||
else:
|
||||
transaction = self.__open_transactions[i]
|
||||
transaction_data = transaction.transaction_fee.to_bytes(8, "big") + \
|
||||
transaction.sender_pubkey + \
|
||||
transaction.sender + \
|
||||
transaction.id.to_bytes(4, "big")
|
||||
current_hash = hashlib.sha256(current_hash + transaction_data).digest()
|
||||
self.__hashes.append(current_hash)
|
||||
@@ -265,8 +265,8 @@ class Blockchain:
|
||||
self.__block_map = {}
|
||||
self.__latest_block_hash = None
|
||||
self.__lock = Lock()
|
||||
self.__load_blocks_from_disk()
|
||||
self.open_transactions = OpenTransactions(self)
|
||||
self.__load_blocks_from_disk()
|
||||
def __load_blocks_from_disk(self):
|
||||
last_valid = None
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user