Merge pull request #5239 from achillesrasquinha/py3-test

Fixed transaction_log test case
This commit is contained in:
Achilles Rasquinha 2018-03-20 20:46:00 +05:30 committed by GitHub
commit 5ca949cc2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,12 +29,19 @@ class TransactionLog(Document):
def hash_line(self):
sha = hashlib.sha256()
sha.update(str(self.row_index) + str(self.timestamp) + str(self.data))
sha.update(
frappe.safe_encode(str(self.row_index)) + \
frappe.safe_encode(str(self.timestamp)) + \
frappe.safe_encode(str(self.data))
)
return sha.hexdigest()
def hash_chain(self):
sha = hashlib.sha256()
sha.update(str(self.transaction_hash) + str(self.previous_hash))
sha.update(
frappe.safe_encode(str(self.transaction_hash)) + \
frappe.safe_encode(str(self.previous_hash))
)
return sha.hexdigest()