add some more useful logging for failed signed blocks in validatemetadata

This commit is contained in:
Kevin Froman 2020-08-23 06:29:12 -05:00
parent 15379a7c2f
commit 68aac2153b

View File

@ -90,6 +90,7 @@ def validate_metadata(metadata, block_data) -> bool:
encodedMeta = bytesconverter.str_to_bytes(metadata['meta']) encodedMeta = bytesconverter.str_to_bytes(metadata['meta'])
encodedBlock = bytesconverter.str_to_bytes(block_data) encodedBlock = bytesconverter.str_to_bytes(block_data)
if not onionrcrypto.signing.ed_verify(encodedMeta + encodedBlock[1:], signer, sig): if not onionrcrypto.signing.ed_verify(encodedMeta + encodedBlock[1:], signer, sig):
logger.warn(f'Block was signed by {signer}, but signature failed')
break break
else: else:
# if metadata loop gets no errors, it does not break, therefore metadata is valid # if metadata loop gets no errors, it does not break, therefore metadata is valid