fix: ensure same-second primary transport change propagates correctly

Without the fix, too fast transport changes are ignored at the receiver side.
This commit is contained in:
holger krekel
2026-08-10 14:20:59 +02:00
parent 805e555a99
commit c3bc26d52f
2 changed files with 81 additions and 22 deletions
+11 -8
View File
@@ -788,16 +788,19 @@ impl Context {
(addr,),
)?;
// Update the timestamp for the primary transport
// so it becomes the first in `get_all_self_addrs()` list
// and the list of relays distributed in the public key.
// This ensures that messages will be sent
// to the primary relay by the contacts
// and will be fetched in background_fetch()
// which only fetches from the primary transport.
// `is_published=1`: an unpublished primary would be missing
// from the relay list in the public key, so contacts would
// never send to it.
//
// The timestamp must strictly increase because
// other devices ignore the row update otherwise,
// and contacts only adopt the re-signed key
// if its signature timestamp increases.
transaction
.execute(
"UPDATE transports SET add_timestamp=?, is_published=1 WHERE addr=?",
"UPDATE transports
SET add_timestamp=MAX(?, add_timestamp+1), is_published=1
WHERE addr=?",
(time(), addr),
)
.context(