Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:type tx_hash: bytes, hexstring
:param public_key: Public key P
:type public_key: HDKey, Key, str, hexstring, bytes
:return bool:
"""
if tx_hash is not None:
self.tx_hash = to_hexstring(tx_hash)
if public_key is not None:
self.public_key = public_key
if not self.tx_hash or not self.public_key:
raise BKeyError("Please provide tx_hash and public_key to verify signature")
if USE_FASTECDSA:
return _ecdsa.verify(
str(self.r),
str(self.s),
self.tx_hash,
str(self.x),
str(self.y),
str(secp256k1_p),
str(secp256k1_a),
str(secp256k1_b),
str(secp256k1_n),
str(secp256k1_Gx),
str(secp256k1_Gy)
)
else:
transaction_to_sign = to_bytes(self.tx_hash)
signature = self.bytes()
if len(transaction_to_sign) != 32: