bug fixes and work on fs
This commit is contained in:
parent
5f67cc388f
commit
0b9bb42927
@ -94,7 +94,7 @@ class OnionrCommunicatorDaemon:
|
||||
OnionrCommunicatorTimers(self, self.getBlocks, self._core.config.get('timers.getBlocks'), requiresPeer=True)
|
||||
OnionrCommunicatorTimers(self, self.clearOfflinePeer, 58)
|
||||
OnionrCommunicatorTimers(self, self.daemonTools.cleanOldBlocks, 65)
|
||||
OnionrCommunicatorTimers(self, self.lookupKeys, 60, requiresPeer=True)
|
||||
#OnionrCommunicatorTimers(self, self.lookupKeys, 60, requiresPeer=True)
|
||||
OnionrCommunicatorTimers(self, self.lookupAdders, 60, requiresPeer=True)
|
||||
OnionrCommunicatorTimers(self, self.daemonTools.cooldownPeer, 30, requiresPeer=True)
|
||||
netCheckTimer = OnionrCommunicatorTimers(self, self.daemonTools.netCheck, 600)
|
||||
|
@ -228,7 +228,7 @@ class Block:
|
||||
blockFile.write(self.getRaw().encode())
|
||||
self.update()
|
||||
else:
|
||||
self.hash = self.getCore().insertBlock(self.getContent(), header = self.getType(), sign = sign)
|
||||
self.hash = self.getCore().insertBlock(self.getContent(), header = self.getType(), sign = sign, expire=self.getExpire())
|
||||
self.update()
|
||||
|
||||
return self.getHash()
|
||||
@ -241,6 +241,15 @@ class Block:
|
||||
|
||||
# getters
|
||||
|
||||
def getExpire(self):
|
||||
'''
|
||||
Returns the expire time for a block
|
||||
|
||||
Outputs:
|
||||
- (int): the expire time for a block, or None
|
||||
'''
|
||||
return self.expire
|
||||
|
||||
def getHash(self):
|
||||
'''
|
||||
Returns the hash of the block if saved to file
|
||||
|
@ -372,7 +372,12 @@ class OnionrUtils:
|
||||
logger.warn('Block has invalid metadata key ' + i)
|
||||
break
|
||||
else:
|
||||
if self._core.requirements.blockMetadataLengths[i] < len(metadata[i]):
|
||||
testData = metadata[i]
|
||||
try:
|
||||
testData = len(testData)
|
||||
except (TypeError, AttributeError) as e:
|
||||
testData = len(str(testData))
|
||||
if self._core.requirements.blockMetadataLengths[i] < testData:
|
||||
logger.warn('Block metadata key ' + i + ' exceeded maximum size')
|
||||
break
|
||||
if i == 'time':
|
||||
|
@ -45,9 +45,9 @@ class OnionrFlow:
|
||||
self.flowRunning = False
|
||||
if message == "q":
|
||||
self.flowRunning = False
|
||||
|
||||
expireTime = self.myCore._utils.getEpoch() + 43200
|
||||
if len(message) > 0:
|
||||
Block(content = message, type = 'txt', core = self.myCore).save()
|
||||
Block(content = message, type = 'txt', expire=expireTime, core = self.myCore).save()
|
||||
|
||||
logger.info("Flow is exiting, goodbye")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user