actually handle future-set blocks properly

This commit is contained in:
Kevin Froman 2018-12-15 23:35:06 -06:00
parent a4370c26b0
commit 98bc3b3271
2 changed files with 4 additions and 7 deletions

View File

@ -33,9 +33,7 @@ class OnionrCrypto:
self._keyFile = self._core.dataDir + 'keys.txt' self._keyFile = self._core.dataDir + 'keys.txt'
self.pubKey = None self.pubKey = None
self.privKey = None self.privKey = None
self.secrets = secrets self.secrets = secrets
self.deterministicRequirement = 25 # Min deterministic password/phrase length self.deterministicRequirement = 25 # Min deterministic password/phrase length
self.HASH_ID_ROUNDS = 2000 self.HASH_ID_ROUNDS = 2000
self.keyManager = keymanager.KeyManager(self) self.keyManager = keymanager.KeyManager(self)
@ -99,7 +97,6 @@ class OnionrCrypto:
def pubKeyEncrypt(self, data, pubkey, anonymous=True, encodedData=False): def pubKeyEncrypt(self, data, pubkey, anonymous=True, encodedData=False):
'''Encrypt to a public key (Curve25519, taken from base32 Ed25519 pubkey)''' '''Encrypt to a public key (Curve25519, taken from base32 Ed25519 pubkey)'''
retVal = '' retVal = ''
try: try:
pubkey = pubkey.encode() pubkey = pubkey.encode()
except AttributeError: except AttributeError:

View File

@ -392,7 +392,7 @@ class OnionrUtils:
if not self.isIntegerString(metadata[i]): if not self.isIntegerString(metadata[i]):
logger.warn('Block metadata time stamp is not integer string') logger.warn('Block metadata time stamp is not integer string')
break break
if metadata[i] > self.getEpoch(): if (metadata[i] - self.getEpoch()) > 30:
logger.warn('Block metadata time stamp is set for the future, which is not allowed.') logger.warn('Block metadata time stamp is set for the future, which is not allowed.')
break break
if (self.getEpoch() - metadata[i]) > maxAge: if (self.getEpoch() - metadata[i]) > maxAge: