def calc_sha256(self):
    if (self.sha256 is None):
        r = b''
        r += struct.pack('<i', self.nVersion)
        r += ser_uint256(self.hashPrevBlock)
        r += ser_uint256(self.hashMerkleRoot)
        r += struct.pack('<I', self.nTime)
        r += struct.pack('<I', self.nufos)
        r += struct.pack('<I', self.nNonce)
        self.sha256 = uint256_from_str(hash256(r))
        self.hash = encode(hash256(r)[::(- 1)], 'hex_codec').decode('ascii')
def calc_sha256(self):
    if (self.sha256 is None):
        r = b
        r += struct.pack('<i', self.nVersion)
        r += ser_uint256(self.hashPrevBlock)
        r += ser_uint256(self.hashMerkleRoot)
        r += struct.pack('<I', self.nTime)
        r += struct.pack('<I', self.nufos)
        r += struct.pack('<I', self.nNonce)
        self.sha256 = uint256_from_str(hash256(r))
        self.hash = encode(hash256(r)[::(- 1)], 'hex_codec').decode('ascii')