Fixed static destination size
This commit is contained in:
parent
e19438fdcc
commit
40e25d8e40
@ -120,14 +120,16 @@ def client(destination_hexhash, configpath, timeout=None):
|
|||||||
# We need a binary representation of the destination
|
# We need a binary representation of the destination
|
||||||
# hash that was entered on the command line
|
# hash that was entered on the command line
|
||||||
try:
|
try:
|
||||||
if len(destination_hexhash) != 20:
|
dest_len = (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2
|
||||||
|
if len(destination_hexhash) != dest_len:
|
||||||
raise ValueError(
|
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)
|
destination_hash = bytes.fromhex(destination_hexhash)
|
||||||
except:
|
except Exception as e:
|
||||||
RNS.log("Invalid destination entered. Check your input!\n")
|
RNS.log("Invalid destination entered. Check your input!")
|
||||||
|
RNS.log(str(e)+"\n")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
# We must first initialise Reticulum
|
# We must first initialise Reticulum
|
||||||
|
Loading…
Reference in New Issue
Block a user