Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | class CTransaction(): | ||||
# 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') | ||||
def get_id(self): | |||||
# For now, just forward thr hash. | |||||
self.calc_sha256() | |||||
return self.hash | |||||
def is_valid(self): | def is_valid(self): | ||||
self.calc_sha256() | self.calc_sha256() | ||||
for tout in self.vout: | for tout in self.vout: | ||||
if tout.nValue < 0 or tout.nValue > 21000000 * COIN: | if tout.nValue < 0 or tout.nValue > 21000000 * COIN: | ||||
return False | return False | ||||
return True | return True | ||||
def __repr__(self): | def __repr__(self): | ||||
▲ Show 20 Lines • Show All 1,330 Lines • Show Last 20 Lines |