Only index messages with stamp value set

This commit is contained in:
Mark Qvist 2025-11-02 12:02:21 +01:00
parent 1b5dc419b5
commit 99830b6e8b

View file

@ -544,21 +544,19 @@ class LXMRouter:
st = time.time(); RNS.log("Indexing messagestore...", RNS.LOG_NOTICE) st = time.time(); RNS.log("Indexing messagestore...", RNS.LOG_NOTICE)
for filename in os.listdir(self.messagepath): for filename in os.listdir(self.messagepath):
components = filename.split("_") components = filename.split("_")
if len(components) >= 2: if len(components) >= 3:
if float(components[1]) > 0: if float(components[1]) > 0:
if len(components[0]) == RNS.Identity.HASHLENGTH//8*2: if len(components[0]) == RNS.Identity.HASHLENGTH//8*2:
try: try:
transient_id = bytes.fromhex(components[0]) transient_id = bytes.fromhex(components[0])
received = float(components[1]) received = float(components[1])
stamp_value = int(components[2])
filepath = self.messagepath+"/"+filename filepath = self.messagepath+"/"+filename
msg_size = os.path.getsize(filepath) msg_size = os.path.getsize(filepath)
file = open(filepath, "rb") file = open(filepath, "rb")
destination_hash = file.read(LXMessage.DESTINATION_LENGTH) destination_hash = file.read(LXMessage.DESTINATION_LENGTH)
file.close() file.close()
if len(components) >= 3: stamp_value = int(components[2])
else: stamp_value = None
self.propagation_entries[transient_id] = [ self.propagation_entries[transient_id] = [
destination_hash, # 0: Destination hash destination_hash, # 0: Destination hash
filepath, # 1: Storage location filepath, # 1: Storage location