actually handle future-set blocks properly
parent
a4370c26b0
commit
98bc3b3271
|
@ -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:
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue