changrd saveFile > addFile
This commit is contained in:
parent
d5a66cee05
commit
886632550d
@ -83,7 +83,7 @@ class MenuHelper:
|
|||||||
new_tx.createRewardTransaction(self.user.public_ser, self.user.private_ser, "SIGNUP")
|
new_tx.createRewardTransaction(self.user.public_ser, self.user.private_ser, "SIGNUP")
|
||||||
if new_tx != False and new_tx.is_valid():
|
if new_tx != False and new_tx.is_valid():
|
||||||
print(f"{utilityHelper.blinkMessage('Received sign up bonus')}")
|
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
|
return
|
||||||
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")
|
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")
|
||||||
print(f"{utilityHelper.errorMessage('Registration failed')}")
|
print(f"{utilityHelper.errorMessage('Registration failed')}")
|
||||||
@ -144,7 +144,7 @@ class MenuHelper:
|
|||||||
new_tx = transactionHelper.transaction(self)
|
new_tx = transactionHelper.transaction(self)
|
||||||
if new_tx != False and new_tx.is_valid():
|
if new_tx != False and new_tx.is_valid():
|
||||||
print(f"{utilityHelper.successMessage('Transaction 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
|
continue
|
||||||
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")
|
print(f"{utilityHelper.errorMessage('Transaction is invalid')}")
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ def pendingTransactions(self):
|
|||||||
|
|
||||||
# add old transactions to pool
|
# add old transactions to pool
|
||||||
for transaction in transactions:
|
for transaction in transactions:
|
||||||
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
|
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
|
||||||
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
|
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
|
||||||
|
|
||||||
utilityHelper.clearScreen()
|
utilityHelper.clearScreen()
|
||||||
print("Transaction modified")
|
print("Transaction modified")
|
||||||
@ -193,8 +193,8 @@ def pendingTransactions(self):
|
|||||||
# add old transactions to pool
|
# add old transactions to pool
|
||||||
for transaction in transactions:
|
for transaction in transactions:
|
||||||
print(transaction)
|
print(transaction)
|
||||||
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
|
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
|
||||||
utilityHelper.saveFile("../data/transaction_pool.dat", new_tx)
|
utilityHelper.addFile("../data/transaction_pool.dat", new_tx)
|
||||||
|
|
||||||
utilityHelper.clearScreen()
|
utilityHelper.clearScreen()
|
||||||
print("Transaction modified")
|
print("Transaction modified")
|
||||||
@ -207,7 +207,7 @@ def pendingTransactions(self):
|
|||||||
|
|
||||||
# add old transactions to pool
|
# add old transactions to pool
|
||||||
for transaction in transactions:
|
for transaction in transactions:
|
||||||
utilityHelper.saveFile("../data/transaction_pool.dat", transaction)
|
utilityHelper.addFile("../data/transaction_pool.dat", transaction)
|
||||||
utilityHelper.clearScreen()
|
utilityHelper.clearScreen()
|
||||||
print("Transaction cancelled")
|
print("Transaction cancelled")
|
||||||
return
|
return
|
||||||
|
@ -45,7 +45,7 @@ def createFile(fileloc):
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def saveFile(fileloc, data):
|
def addFile(fileloc, data):
|
||||||
savefile = open(fileloc, "ab")
|
savefile = open(fileloc, "ab")
|
||||||
pickle.dump(data, savefile)
|
pickle.dump(data, savefile)
|
||||||
savefile.close()
|
savefile.close()
|
||||||
@ -67,9 +67,7 @@ def loadFile(fileloc):
|
|||||||
return objs
|
return objs
|
||||||
|
|
||||||
def loginStartup(self):
|
def loginStartup(self):
|
||||||
# TODO - check if there are unvalidated blocks
|
|
||||||
blockHelper.validateMinedBlock(self)
|
blockHelper.validateMinedBlock(self)
|
||||||
# TODO - check if there are any notifcations
|
|
||||||
taskHelper.displayUnreadLogs(self)
|
taskHelper.displayUnreadLogs(self)
|
||||||
|
|
||||||
def errorMessage(text):
|
def errorMessage(text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user