fix: standardize packet hash casing to uppercase in RepeaterHandler and RepeaterDaemon

This commit is contained in:
Lloyd
2025-11-24 09:58:13 +00:00
parent 34a775925b
commit bdc38c5307
3 changed files with 5 additions and 11 deletions
@@ -33,12 +33,6 @@ LETSMESH_BROKERS = [
"port": 443,
"audience": "mqtt-us-v1.letsmesh.net",
},
{
"name": "Europe (LetsMesh v1)",
"host": "mqtt-eu-v1.letsmesh.net",
"port": 443,
"audience": "mqtt-eu-v1.letsmesh.net",
},
]
+3 -3
View File
@@ -184,7 +184,7 @@ class RepeaterHandler(BaseHandler):
)
# Check if this is a duplicate
pkt_hash = packet.calculate_packet_hash().hex()
pkt_hash = packet.calculate_packet_hash().hex().upper()
is_dupe = pkt_hash in self.seen_packets and not transmitted
# Set drop reason for duplicates
@@ -418,14 +418,14 @@ class RepeaterHandler(BaseHandler):
def is_duplicate(self, packet: Packet) -> bool:
pkt_hash = packet.calculate_packet_hash().hex()
pkt_hash = packet.calculate_packet_hash().hex().upper()
if pkt_hash in self.seen_packets:
return True
return False
def mark_seen(self, packet: Packet):
pkt_hash = packet.calculate_packet_hash().hex()
pkt_hash = packet.calculate_packet_hash().hex().upper()
self.seen_packets[pkt_hash] = time.time()
if len(self.seen_packets) > self.max_cache_size:
+2 -2
View File
@@ -194,7 +194,7 @@ class RepeaterDaemon:
"tx_delay_ms": 0,
"transmitted": False,
"is_duplicate": False,
"packet_hash": packet.calculate_packet_hash().hex()[:16],
"packet_hash": packet.calculate_packet_hash().hex().upper()[:16],
"drop_reason": "trace_received",
"path_hash": path_hash,
"src_hash": None,
@@ -235,7 +235,7 @@ class RepeaterDaemon:
self.repeater_handler and not self.repeater_handler.is_duplicate(packet)):
if self.repeater_handler and hasattr(self.repeater_handler, 'recent_packets'):
packet_hash = packet.calculate_packet_hash().hex()[:16]
packet_hash = packet.calculate_packet_hash().hex().upper()[:16]
for record in reversed(self.repeater_handler.recent_packets):
if record.get("packet_hash") == packet_hash:
record["transmitted"] = True