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
1 changed files with 3 additions and 2 deletions

View File

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