mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-08-08 14:32:47 -04:00
Added automatic ratchet reload if required ratchet is unavailable
This commit is contained in:
parent
3a580e74de
commit
a072a5b074
2 changed files with 58 additions and 32 deletions
|
@ -324,11 +324,11 @@ class Identity:
|
|||
if not destination_hash in Identity.known_ratchets:
|
||||
ratchetdir = RNS.Reticulum.storagepath+"/ratchets"
|
||||
hexhash = RNS.hexrep(destination_hash, delimit=False)
|
||||
ratchet_path = f"{ratchetdir}/hexhash"
|
||||
ratchet_path = f"{ratchetdir}/{hexhash}"
|
||||
if os.path.isfile(ratchet_path):
|
||||
try:
|
||||
ratchet_file = open(ratchet_path, "rb")
|
||||
ratchet_data = umsgpack.unpackb(ratchets_file.read())
|
||||
ratchet_data = umsgpack.unpackb(ratchet_file.read())
|
||||
if time.time() < ratchet_data["received"]+Identity.RATCHET_EXPIRY and len(ratchet_data["ratchet"]) == Identity.RATCHETSIZE//8:
|
||||
Identity.known_ratchets[destination_hash] = ratchet_data["ratchet"]
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue