changrd saveFile > addFile

This commit is contained in:
Ryan Bakkes 2023-11-12 09:53:33 +01:00
parent d5a66cee05
commit 886632550d
3 changed files with 8 additions and 10 deletions

View File

@ -83,7 +83,7 @@ class MenuHelper:
new_tx.createRewardTransaction(self.user.public_ser, self.user.private_ser, "SIGNUP")
if new_tx != False and new_tx.is_valid():
print(f"{utilityHelper.blinkMessage('Received sign up bonus')}")
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
return
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")
print(f"{utilityHelper.errorMessage('Registration failed')}")
@ -144,7 +144,7 @@ class MenuHelper:
new_tx = transactionHelper.transaction(self)
if new_tx != False and new_tx.is_valid():
print(f"{utilityHelper.successMessage('Transaction is valid')}")
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
continue
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")

View File

@ -163,8 +163,8 @@ def pendingTransactions(self):
# add old transactions to pool
for transaction in transactions:
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
utilityHelper.clearScreen()
print("Transaction modified")
@ -193,8 +193,8 @@ def pendingTransactions(self):
# add old transactions to pool
for transaction in transactions:
print(transaction)
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
utilityHelper.clearScreen()
print("Transaction modified")
@ -207,7 +207,7 @@ def pendingTransactions(self):
# add old transactions to pool
for transaction in transactions:
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
utilityHelper.clearScreen()
print("Transaction cancelled")
return

View File

@ -45,7 +45,7 @@ def createFile(fileloc):
except:
return False
def saveFile(fileloc, data):
def addFile(fileloc, data):
savefile = open(fileloc, "ab")
pickle.dump(data, savefile)
savefile.close()
@ -67,9 +67,7 @@ def loadFile(fileloc):
return objs
def loginStartup(self):
# TODO - check if there are unvalidated blocks
blockHelper.validateMinedBlock(self)
# TODO - check if there are any notifcations
taskHelper.displayUnreadLogs(self)
def errorMessage(text):