Skip to content

[Bug]: migrateChannelsByPSK misclassifies messages when there are multiple with the same key #4293

Description

@ianmcorvidae

Contact Details

discord m_ia_n

Checklist

  • I am able to reproduce the bug with the latest version.

  • I have updated to the latest Alpha firmware, and am able to reproduce the bug. Many issues are fixed quickly in alpha before the general beta release.

  • I made sure that there are no existing OPEN or CLOSED issues which I could contribute my information to.

  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.

  • This issue contains only one bug.

  • I have read and understood the Contribution Guidelines.

  • I agree to follow this project's Code of Conduct

  • I actually read this list, and should be taken seriously.

Affected app version

2.7.9 google

Affected Android version

13

Affected phone model

Google Pixel 4a

Affected node model

Seeed T-1000E

Affected node firmware version

2.7.15

Steps to reproduce the bug

  1. Have some messages in a channel; this is easiest with the default channel with a PSK of AQ==
  2. Go into settings and add a channel with the same PSK
  3. Save

Actual behavior

Due to changing the set of channels, the messages from the previous channel are moved to the new channel with the same PSK, rather than retaining their connection to the still-present prior channel.

Expected behavior

Messages should retain their connection to an unchanged channel, even if there are multiple channels, of different names, with the same PSK.

Screenshots/Screen recordings

No response

Relevant log output

Additional information

This came up because our local mesh uses a separate channel for testing things, but we use the same AQ== key for it for ease of use with MQTT tools. When rearranging or adding/removing channels, messages would jump between the different AQ== channels basically at random.

This is, I believe, happening because the migrateChannelsByPSK method in core/database/src/main/kotlin/org/meshtastic/core/database/dao/PacketDao.kt is, as the name suggests, only considering the PSK of a channel when moving messages around after channel settings change. Since meshtastic itself identifies channels by the PSK plus the channel name (or, over the air, by a hash generated from those two values), the PSK alone isn't enough information to retain channel identity.

The app should be retaining the channel name associated with a message in addition to the PSK. Or, alternately, should be retaining and identifying using the channel hash byte.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions