Copy object contents from buffers on instantiation

- this may fix some memory issues
This commit is contained in:
Peter Šurda 2017-11-17 23:53:46 +01:00
parent 3c3d69e5de
commit 4690dd6f00
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -40,8 +40,9 @@ class BMObject(object):
self.version = version self.version = version
self.streamNumber = streamNumber self.streamNumber = streamNumber
self.inventoryHash = calculateInventoryHash(data) self.inventoryHash = calculateInventoryHash(data)
self.data = data # copy to avoid memory issues
self.tag = data[payloadOffset:payloadOffset+32] self.data = bytearray(data)
self.tag = self.data[payloadOffset:payloadOffset+32]
def checkProofOfWorkSufficient(self): def checkProofOfWorkSufficient(self):
# Let us check to make sure that the proof of work is sufficient. # Let us check to make sure that the proof of work is sufficient.