From 962fed1c92180c2f9fe6e779c130fc988bee91a7 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Sun, 19 Apr 2026 14:35:31 -0300 Subject: [PATCH] feat: Never remove primary transport when applying SyncTransports message If we missed a message changing the primary transport, we shouldn't remove it when applying a SyncTransports message, such a state doesn't look correct even if it's temporary. --- src/receive_imf.rs | 2 -- src/transport.rs | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 0415d76b4..7100e4ea8 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -857,8 +857,6 @@ UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1 if transport_changed { info!(context, "Primary transport changed to {from_addr:?}."); context.sql.uncache_raw_config("configured_addr").await; - - // Regenerate User ID in V4 keys. context.self_public_key.lock().await.take(); context.emit_event(EventType::TransportsModified); diff --git a/src/transport.rs b/src/transport.rs index fafe19377..7047d129a 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -791,7 +791,18 @@ pub(crate) async fn sync_transports( context .sql .transaction(|transaction| { + let configured_addr = transaction.query_row( + "SELECT value FROM config WHERE keyname='configured_addr'", + (), + |row| { + let addr: String = row.get(0)?; + Ok(addr) + }, + )?; for RemovedTransportData { addr, timestamp } in removed_transports { + if *addr == configured_addr { + continue; + } modified |= transaction.execute( "DELETE FROM transports WHERE addr=? AND add_timestamp<=?",