Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/messages.py
Show First 20 Lines • Show All 395 Lines • ▼ Show 20 Lines | def serialize(self): | ||||
r += ser_vector(self.vout) | r += ser_vector(self.vout) | ||||
r += struct.pack("<I", self.nLockTime) | r += struct.pack("<I", self.nLockTime) | ||||
return r | return r | ||||
# Recalculate the txid | # Recalculate the txid | ||||
def rehash(self): | def rehash(self): | ||||
self.sha256 = None | self.sha256 = None | ||||
self.calc_sha256() | self.calc_sha256() | ||||
return self.hash | |||||
# self.sha256 and self.hash -- those are expected to be the txid. | # self.sha256 and self.hash -- those are expected to be the txid. | ||||
def calc_sha256(self): | def calc_sha256(self): | ||||
if self.sha256 is None: | if self.sha256 is None: | ||||
self.sha256 = uint256_from_str(hash256(self.serialize())) | self.sha256 = uint256_from_str(hash256(self.serialize())) | ||||
self.hash = encode( | self.hash = encode( | ||||
hash256(self.serialize())[::-1], 'hex_codec').decode('ascii') | hash256(self.serialize())[::-1], 'hex_codec').decode('ascii') | ||||
▲ Show 20 Lines • Show All 807 Lines • Show Last 20 Lines |