Skip to content

Add a new peer storage format to handle legacy backups#807

Merged
pm47 merged 1 commit intomasterfrom
migrate-peer-storage
Sep 17, 2025
Merged

Add a new peer storage format to handle legacy backups#807
pm47 merged 1 commit intomasterfrom
migrate-peer-storage

Conversation

@pm47
Copy link
Member

@pm47 pm47 commented Sep 16, 2025

Our current peer storage data format is encrypt(list(channel)).

We add a new format: list(encrypt(channel)).

This allows handling of legacy proprietary per-channel backups: on the LSP side, we just need to concatenate legacy backups and set that as the peer storage, and then reject channel updates with the legacy backup method (we actually just reject connections from peers that do not support the peer storage backup).

Note that we do not yet remove the "restore from channel_reestablish" logic, so that we don't have to synchronize the phoenix update with the LSP update.

Comment on lines +130 to +132
runCatching { decrypt(key.value, data.drop(2).toByteArray()) }
.recoverCatching { decrypt(key.value, data) }
.map { Serialization.deserialize(it) }
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same contant as the fun PersistedChannelState.Companion.from() function above, but that function will be deleted once the migration is done, so factoring wasn't worth it.

@pm47 pm47 requested a review from t-bast September 16, 2025 15:37
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@pm47 pm47 merged commit 09c4392 into master Sep 17, 2025
2 checks passed
@pm47 pm47 deleted the migrate-peer-storage branch September 17, 2025 09:10
pm47 added a commit that referenced this pull request Sep 24, 2025
This is a follow-up to #807.

Note that we cannot remove some legacy classes such as `EncryptedChannelData`,
due to the legacy v2/v3 serialization depending on it.
@pm47 pm47 mentioned this pull request Sep 24, 2025
pm47 added a commit that referenced this pull request Sep 26, 2025
This is a follow-up to #807.

Note that we cannot remove some legacy classes such as `EncryptedChannelData`, due to the legacy v2/v3 serialization depending on it.
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.

2 participants