This commit is contained in:
Mark Qvist 2026-11-02 20:50:15 +01:00
parent fa683e6c21
commit d5891fde14
No known key found for this signature in database
3 changed files with 6 additions and 5 deletions

View file

@ -735,8 +735,9 @@ class Identity:
signal_str += "]"
else: signal_str = ""
if r["transport_id"] != None: RNS.log("Valid announce for "+RNS.prettyhexrep(r["destination_hash"])+" "+str(r["hops"])+" hops away, received via "+RNS.prettyhexrep(r["transport_id"])+" on "+str(r["receiving_interface"])+signal_str, valid_announce_loglevel)
else: RNS.log("Valid announce for "+RNS.prettyhexrep(r["destination_hash"])+" "+str(r["hops"])+" hops away, received on "+str(r["receiving_interface"])+signal_str, valid_announce_loglevel)
via_str = f" via {RNS.prettyhexrep(r['transport_id'])}" if r["transport_id"] else ""
val_str = f" (v:{RNS.prettycost(r['stamp_value'])})"
RNS.log(f"Valid announce for {RNS.prettyhexrep(r['destination_hash'])}{val_str} {r['hops']} hops away, received{via_str} on {r['receiving_interface']}{signal_str}", valid_announce_loglevel)
return True

View file

@ -2725,7 +2725,7 @@ class Transport:
Transport.mark_path_unknown_state(packet.destination_hash)
if RNS.sl(RNS.LOG_PATHING):
destination_value = RNS.Identity.recall_stamp_value(packet.destination_hash)
value_str = f" (v:{destination_value})" if destination_value else " (v:n)"
value_str = f" (v:{RNS.prettycost(destination_value)})" if destination_value else " (v:n)"
RNS.log(f"Destination {RNS.prettyhexrep(packet.destination_hash)}{value_str} is now {announce_hops} hops away via {RNS.prettyhexrep(received_from)} on {packet.receiving_interface}", RNS.LOG_PATHING)
if packet.destination_hash in Transport.path_requests:

View file

@ -181,8 +181,8 @@ def prettyhexrep(data):
return hexrep
def prettycost(value):
if value == None: return "?"
elif not type(value) in (float, int): return "?"
if value == None: return "n"
elif not type(value) in (float, int): return "n"
else: return f"{quantize_cost(value):.3f}"
def prettyspeed(num, suffix="b"):