From 40e25d8e406bcba3f5f8a5a50edd50e53bc32c13 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 30 Jun 2022 19:12:44 +0200 Subject: [PATCH] Fixed static destination size --- Examples/Echo.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Examples/Echo.py b/Examples/Echo.py index fea5333..529dcec 100644 --- a/Examples/Echo.py +++ b/Examples/Echo.py @@ -120,14 +120,16 @@ def client(destination_hexhash, configpath, timeout=None): # We need a binary representation of the destination # hash that was entered on the command line try: - if len(destination_hexhash) != 20: + dest_len = (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2 + if len(destination_hexhash) != dest_len: raise ValueError( - "Destination length is invalid, must be 20 hexadecimal characters (10 bytes)" + "Destination length is invalid, must be {hex} hexadecimal characters ({byte} bytes).".format(hex=dest_len, byte=dest_len//2) ) destination_hash = bytes.fromhex(destination_hexhash) - except: - RNS.log("Invalid destination entered. Check your input!\n") + except Exception as e: + RNS.log("Invalid destination entered. Check your input!") + RNS.log(str(e)+"\n") exit() # We must first initialise Reticulum