Updated code quality binary operator line change & ignore base except warning in protocol.py

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-08-13 21:34:58 +05:30
parent da7f5102d6
commit ccff8a09f3
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -277,8 +277,8 @@ def isProofOfWorkSufficient(
).digest()).digest()[0:8]) ).digest()).digest()[0:8])
return POW <= 2 ** 64 / ( return POW <= 2 ** 64 / (
nonceTrialsPerByte * ( nonceTrialsPerByte * (
len(data) + payloadLengthExtraBytes + len(data) + payloadLengthExtraBytes
((TTL * (len(data) + payloadLengthExtraBytes)) / (2 ** 16)))) + ((TTL * (len(data) + payloadLengthExtraBytes)) / (2 ** 16))))
# Packet creation # Packet creation
@ -307,9 +307,9 @@ def assembleVersionMessage(
# bitflags of the services I offer. # bitflags of the services I offer.
payload += pack( payload += pack(
'>q', '>q',
NODE_NETWORK | NODE_NETWORK
(NODE_SSL if haveSSL(server) else 0) | | (NODE_SSL if haveSSL(server) else 0)
(NODE_DANDELION if state.dandelion else 0) | (NODE_DANDELION if state.dandelion else 0)
) )
payload += pack('>q', int(time.time())) payload += pack('>q', int(time.time()))
@ -331,9 +331,9 @@ def assembleVersionMessage(
# bitflags of the services I offer. # bitflags of the services I offer.
payload += pack( payload += pack(
'>q', '>q',
NODE_NETWORK | NODE_NETWORK
(NODE_SSL if haveSSL(server) else 0) | | (NODE_SSL if haveSSL(server) else 0)
(NODE_DANDELION if state.dandelion else 0) | (NODE_DANDELION if state.dandelion else 0)
) )
# = 127.0.0.1. This will be ignored by the remote host. # = 127.0.0.1. This will be ignored by the remote host.
# The actual remote connected IP will be used. # The actual remote connected IP will be used.
@ -449,7 +449,7 @@ def decryptAndCheckPubkeyPayload(data, address):
return 'failed' return 'failed'
try: try:
decryptedData = cryptorObject.decrypt(encryptedData) decryptedData = cryptorObject.decrypt(encryptedData)
except: except: # noqa:E722
# Someone must have encrypted some data with a different key # Someone must have encrypted some data with a different key
# but tagged it with a tag for which we are watching. # but tagged it with a tag for which we are watching.
logger.info('Pubkey decryption was unsuccessful.') logger.info('Pubkey decryption was unsuccessful.')