1
0

ecc: API changes: verify_message_hash to return bool instead of raising

verify_message_hash and verify_message_for_address now return bool
instead of raising Exceptions on bad signatures.
This commit is contained in:
SomberNight
2022-02-16 17:23:23 +01:00
parent 57583c05cf
commit 4f9e4c520f
5 changed files with 38 additions and 47 deletions

View File

@@ -508,7 +508,8 @@ def lndecode(invoice: str, *, verbose=False, net=None) -> LnAddr:
#
# A reader MUST use the `n` field to validate the signature instead of
# performing signature recovery if a valid `n` field is provided.
ecc.ECPubkey(addr.pubkey).verify_message_hash(sigdecoded[:64], hrp_hash)
if not ecc.ECPubkey(addr.pubkey).verify_message_hash(sigdecoded[:64], hrp_hash):
raise LnDecodeException("bad signature")
pubkey_copy = addr.pubkey
class WrappedBytesKey:
serialize = lambda: pubkey_copy