Merge pull request #45 from jaicis/py3convert
Solved python2 to python3 message receiving issue and removed unrequi…
This commit is contained in:
commit
0e8a230156
|
@ -144,11 +144,11 @@ class objectProcessor(threading.Thread):
|
|||
sqlExecute(
|
||||
'UPDATE sent SET status=?, lastactiontime=?'
|
||||
' WHERE ackdata=?',
|
||||
'ackreceived', int(time.time()), data[readPosition:])
|
||||
'ackreceived', int(time.time()), bytes(data[readPosition:]))
|
||||
queues.UISignalQueue.put((
|
||||
'updateSentItemStatusByAckdata',
|
||||
(
|
||||
data[readPosition:],
|
||||
bytes(data[readPosition:]),
|
||||
tr._translate(
|
||||
"MainWindow",
|
||||
"Acknowledgement of the message received %1"
|
||||
|
|
|
@ -687,9 +687,14 @@ def _unpack_binary(code, fp, options):
|
|||
length = struct.unpack(">I", _read_except(fp, 4))[0]
|
||||
else:
|
||||
raise Exception("logic error, not binary: 0x%02x" % ord(code))
|
||||
|
||||
return _read_except(fp, length)
|
||||
|
||||
#Added Decode method for python3
|
||||
data = _read_except(fp, length)
|
||||
try:
|
||||
return bytes.decode(data, 'utf-8')
|
||||
except UnicodeDecodeError:
|
||||
if options.get("allow_invalid_utf8"):
|
||||
return InvalidString(data)
|
||||
raise InvalidStringException("unpacked string is invalid utf-8")
|
||||
|
||||
def _unpack_ext(code, fp, options):
|
||||
if code == b'\xd4':
|
||||
|
|
|
@ -54,7 +54,6 @@ def encrypt(msg, hexPubkey):
|
|||
|
||||
|
||||
def decrypt(msg, hexPrivkey):
|
||||
print("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS#################################################")
|
||||
"""Decrypts message with hex private key"""
|
||||
return makeCryptor(hexPrivkey).decrypt(msg)
|
||||
|
||||
|
|
|
@ -444,7 +444,6 @@ def decryptAndCheckPubkeyPayload(data, address):
|
|||
# That sort of address-malleability should have been caught
|
||||
# by the UI or API and an error given to the user.
|
||||
return 'failed'
|
||||
print("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW#################################################")
|
||||
try:
|
||||
decryptedData = cryptorObject.decrypt(encryptedData)
|
||||
except:
|
||||
|
@ -455,7 +454,6 @@ def decryptAndCheckPubkeyPayload(data, address):
|
|||
readPosition = 0
|
||||
# bitfieldBehaviors = decryptedData[readPosition:readPosition + 4]
|
||||
readPosition += 4
|
||||
print("working fine till here#################################################################")
|
||||
publicSigningKey = '\x04'.encode() + decryptedData[readPosition:readPosition + 64]
|
||||
readPosition += 64
|
||||
publicEncryptionKey = '\x04'.encode() + decryptedData[readPosition:readPosition + 64]
|
||||
|
@ -503,7 +501,6 @@ def decryptAndCheckPubkeyPayload(data, address):
|
|||
)
|
||||
t = (address, addressVersion, storedData, int(time.time()), 'yes')
|
||||
sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?,?)''', *t)
|
||||
print("successful Insertion of pubkey hurray#################################################")
|
||||
return 'successful'
|
||||
except varintDecodeError:
|
||||
logger.info(
|
||||
|
|
|
@ -91,7 +91,6 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
|
|||
hashes += (payload for payload, in sqlQuery(
|
||||
'SELECT hash FROM inventory WHERE streamnumber=?'
|
||||
' AND expirestime>?', stream, t))
|
||||
# print('sqlllllllllllllllllllllllllllllllllll',hashes)
|
||||
return hashes
|
||||
|
||||
def flush(self):
|
||||
|
|
Reference in New Issue
Block a user