added 3 minutes interval
This commit is contained in:
parent
a364b07bc9
commit
4a2ea1fa3c
@ -50,6 +50,18 @@ def transaction(self):
|
||||
return new_tx
|
||||
|
||||
def createBlock(self):
|
||||
# add last block if its available
|
||||
try:
|
||||
lastBlock = utilityHelper.loadFile("../data/ledger.dat")
|
||||
except:
|
||||
lastBlock = None
|
||||
if lastBlock != None:
|
||||
lastBlock = lastBlock[-1]
|
||||
|
||||
if lastBlock != None and time.time() - lastBlock.date < 180:
|
||||
print("You can only mine a block every 3 minutes")
|
||||
return False
|
||||
|
||||
transactions = Tx()
|
||||
transactions = utilityHelper.loadFile("../data/transaction_pool.dat")
|
||||
if len(transactions) < 5:
|
||||
@ -117,14 +129,6 @@ def createBlock(self):
|
||||
print("You need atleast 1 transaction from another user")
|
||||
return False
|
||||
|
||||
# add last block if its available
|
||||
try:
|
||||
lastBlock = utilityHelper.loadFileLine("../data/ledger.dat")
|
||||
except:
|
||||
lastBlock = None
|
||||
if lastBlock != None:
|
||||
lastBlock = lastBlock[0]
|
||||
|
||||
block = TxBlock(lastBlock)
|
||||
|
||||
# create block
|
||||
|
Loading…
x
Reference in New Issue
Block a user