Skip to content

Conversation

@iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Jan 10, 2026

This fixes the bug when a new transport doesn't become primary on the 2nd device because INBOX from the new transport isn't fully fetched. Now the Transports sync message is received from the old transport, but as it has updated "From", it updates the primary transport correspondingly. NB: I/O for the new primary transport isn't immediately started however, this needs a separate fix.

There are additional commits, see commit messages. Particularly, fix: Only emit TransportsModified if transports are really modified is needed to fix tests flakiness introduced by the subject change, so not moving it to a separate PR.

Close #7656

@iequidoo
Copy link
Collaborator Author

iequidoo commented Jan 10, 2026

This makes test_transport_synchronization flaky however, probably the test should be fixed.
EDIT: fix: Only emit TransportsModified if transports are really modified fixes this.

@iequidoo iequidoo marked this pull request as draft January 10, 2026 23:25
@iequidoo iequidoo force-pushed the iequidoo/bcc-self-to-all-relays branch from e32b229 to d3bb93d Compare January 11, 2026 16:17
transaction.execute(
"UPDATE config SET value=? WHERE keyname='configured_addr'",
"
UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AND value!=?1 is needed because SQLite counts all updates for which the WHERE condition is true, not just updates that really update rows

@iequidoo iequidoo marked this pull request as ready for review January 11, 2026 16:29
@iequidoo iequidoo force-pushed the iequidoo/bcc-self-to-all-relays branch from d3bb93d to 453ffe4 Compare January 11, 2026 19:08
@iequidoo iequidoo requested a review from link2xt January 11, 2026 19:09
This fixes the bug when a new transport doesn't become primary on the 2nd device because INBOX from
the new transport isn't fully fetched. Now the `Transports` sync message is received from the old
transport, but as it has updated "From", it updates the primary transport correspondingly. NB: I/O
for the new primary transport isn't immediately started however, this needs a separate fix.
This way, if the sync message updates transports, the check for a new primary transport is done
against the updated transport list which is more reliable.
Otherwise it's not possible to write tests reliably because sync messages may be executed multiple
times if they arrive from different transports. This should fix flaky
`test_transport_synchronization`.

Also always emit `TransportsModified` if the primary transport is changed by a sync message, even if
it doesn't contain `SyncData::Transports`.

Also don't decrease `add_timestamp` in `save_transport()` if nothing else changes, this doesn't make
sense.
@iequidoo iequidoo force-pushed the iequidoo/bcc-self-to-all-relays branch from 453ffe4 to a845d1f Compare January 11, 2026 19:42
@iequidoo iequidoo merged commit fe3b1ea into main Jan 11, 2026
30 checks passed
@iequidoo iequidoo deleted the iequidoo/bcc-self-to-all-relays branch January 11, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send bcc-self messages to all own relays

4 participants