Creating a transaction hash to be used in Fireblocks sign request

My signature is not validated in Algorand node and i think perhpas my transaction hash calcuation is wrong. this is my function:

def generate_transaction_hash(unsigned_txn):
txn = encoding.msgpack_encode(unsigned_txn)
to_sign = constants.txid_prefix + base64.b64decode(txn)

# Hash the transaction content to meet Fireblocks' requirements
transaction_hash = hashlib.sha256(to_sign).hexdigest()
return transaction_hash