sign_recoverable can raise a ValueError, handling it.

This commit is contained in:
Sergi Delgado Segura
2020-04-03 21:56:42 +02:00
parent dcb221ea36
commit f350182012

View File

@@ -281,10 +281,15 @@ class Cryptographer:
logger.error("The value passed as sk is not a private key (EllipticCurvePrivateKey)")
return None
try:
rsig_rid = sk.sign_recoverable(LN_MESSAGE_PREFIX + message, hasher=sha256d)
sigrec = sigrec_encode(rsig_rid)
zb32_sig = pyzbase32.encode_bytes(sigrec).decode()
except ValueError:
logger.error("Couldn't sign the message")
return None
return zb32_sig
@staticmethod