def calc_sha256(self, with_witness=False):
    if with_witness:
        return uint256_from_str(hash256(self.serialize_with_witness()))
    if (self.sha256 is None):
        self.sha256 = uint256_from_str(hash256(self.serialize_without_witness()))
    self.hash = hash256(self.serialize_without_witness())[::(- 1)].hex()
def calc_sha256(self, with_witness=False):
    if with_witness:
        return uint256_from_str(hash256(self.serialize_with_witness()))
    if (self.sha256 is None):
        self.sha256 = uint256_from_str(hash256(self.serialize_without_witness()))
    self.hash = hash256(self.serialize_without_witness())[::(- 1)].hex()