send_msg_with_retries: now fetches contacts before resetting path

This commit is contained in:
Florent
2026-09-19 10:59:26 -04:00
parent fa93dc66cb
commit fc7e797e41
+6 -3
View File
@@ -131,7 +131,12 @@ class MessagingCommands(CommandHandlerBase):
while attempts < max_attempts and res is None \ while attempts < max_attempts and res is None \
and (not flood or flood_attempts < max_flood_attempts): and (not flood or flood_attempts < max_flood_attempts):
if attempts == flood_after and not flood : # change path to flood if attempts == flood_after and not flood : # change path to flood
if len(dst_bytes) == 32: # can only reset with full key if len(dst_bytes) < 32: # can only reset with full key
logger.info("Don't have full key, retreiving contacts so we can reset path")
await self.get_contacts()
contact = self._get_contact_by_prefix(dst_bytes.hex())
if not contact is None:
dst_bytes = _validate_destination(contact, prefix_length=32)
logger.info("Resetting path") logger.info("Resetting path")
rp_res = await self.reset_path(dst_bytes) rp_res = await self.reset_path(dst_bytes)
if rp_res.type == EventType.ERROR: if rp_res.type == EventType.ERROR:
@@ -141,8 +146,6 @@ class MessagingCommands(CommandHandlerBase):
if not contact is None: if not contact is None:
contact["out_path"] = "" contact["out_path"] = ""
contact["out_path_len"] = -1 contact["out_path_len"] = -1
else:
logger.info("Don't have full key, can't reset path")
if attempts > 0: if attempts > 0:
logger.info(f"Retry sending msg: {attempts + 1}") logger.info(f"Retry sending msg: {attempts + 1}")