Use locale endoding else this generate error in GU : as default time format can have non ascii char on non english locale, but using ascii in locale can generate UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 :
In PyBitmessage/src/bitmessageqt/__init__.py"
l10n.formatTimestamp())
In PyBitmessage/src/l10n.py", line 81, in formatTimestamp
return unicode(timestring, encoding)
Demote payloadLength from class instance variable to processData local variable as no other function was using it
Improve processData:
-Utilise shared.Header
-Use a memoryview to reduce memory overhead
-Clean up variables before a recursive call
-Strip null bytes from command
Refactor sendData
Various functions:
-Use shared.CreatePacket to generate packets
Fix typo in _checkIPv4Address
Refactored ackDataHasAVaildHeader:
-shared.Header is used as necessary
-avoided slicing wherever possible
-remove trailing null characters when comparing command strings
-don't calculate the checksum of a large payload
Added global variable Header - a compiled Struct to pack/unpack headers so as to avoid repeatedly compiling the same format string
Add a new method CreatePacket to simply and efficiently construct a packet that is ready to be sent
Modify assembleVersionMessage to use CreatePacket
pointMult is faster than the pure python arithmetic.privtopub
Additionally in makeCryptor the call to a.privtopub could have just simply be changed to call the local privToPub but then privkey would have been dehexified twice (once in makeCryptor, then again in privToPub) and privToPub would have hexified its result only for makeCryptor to immediately dehexify it. This sort of unnecessary hexifying/dehexifying seems to occur throughout PyBitmessage.
* Move global variable declaration to prevent warnings
* Fix Address Book and Subscriptions entry prepending
* Fix shared.fixPotentiallyInvalidUTF8Data() corrupting sent subjects and message bodies