-
Notifications
You must be signed in to change notification settings - Fork 276
Migrate closed channels to a dedicated DB table #3170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t-bast
commented
Sep 16, 2025
t-bast
commented
Sep 16, 2025
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
pm47
reviewed
Sep 16, 2025
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/SingleFundingHandlers.scala
Show resolved
Hide resolved
5482fe5 to
1c41bad
Compare
Member
Author
|
Rebased on |
pm47
reviewed
Sep 19, 2025
eclair-core/src/main/scala/fr/acinq/eclair/db/sqlite/SqliteChannelsDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/ChannelData.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
thomash-acinq
previously approved these changes
Sep 23, 2025
pm47
requested changes
Sep 25, 2025
Member
pm47
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The max value for INTEGER is 2,147,483,647 in Postgres. We must use BIGINT for msat balances.
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgChannelsDb.scala
Outdated
Show resolved
Hide resolved
We introduce a `DATA_CLOSED` class with minimal information about a past channel that has been fully closed. This will let us deprecate legacy channels without having backwards-compatibility issues with very old closed channels inside our DB. When channels have never been properly opened or used, we don't bother storing them in our DB, as it would open the door to DoS attacks. We create a dedicated table to store `DATA_CLOSED`. We migrate the existing DB and remove the foreign key constraint on `htlc_infos`.
54f27b7 to
2636a7e
Compare
pm47
approved these changes
Sep 30, 2025
t-bast
added a commit
that referenced
this pull request
Oct 24, 2025
We require closed channels to be migrated to the closed channels table introduced in #3170 before starting `eclair`. This ensures that we will not lose channel data when removing support for non-anchor channels in the next release. Node operators will have to: - run the v0.13.0 release to migrate their channel data to v5 - run the v0.13.1 release to migrate their closed channels Afterwards, they'll be able to update to the (future) v0.14.x release once all of their pre-anchor channels have been closed.
t-bast
added a commit
that referenced
this pull request
Oct 24, 2025
We require closed channels to be migrated to the closed channels table introduced in #3170 before starting `eclair`. This ensures that we will not lose channel data when removing support for non-anchor channels in the next release. Node operators will have to: - run the v0.13.0 release to migrate their channel data to v5 - run the v0.13.1 release to migrate their closed channels Afterwards, they'll be able to update to the (future) v0.14.x release once all of their pre-anchor channels have been closed.
t-bast
added a commit
that referenced
this pull request
Oct 24, 2025
We require closed channels to be migrated to the closed channels table introduced in #3170 before starting `eclair`. This ensures that we will not lose channel data when removing support for non-anchor channels in the next release. Node operators will have to: - run the v0.13.0 release to migrate their channel data to v5 - run the v0.13.1 release to migrate their closed channels Afterwards, they'll be able to update to the (future) v0.14.x release once all of their pre-anchor channels have been closed.
t-bast
added a commit
that referenced
this pull request
Oct 27, 2025
We require closed channels to be migrated to the closed channels table introduced in #3170 before starting `eclair`. This ensures that we will not lose channel data when removing support for non-anchor channels in the next release. Node operators will have to: - run the v0.13.0 release to migrate their channel data to v5 - run the v0.13.1 release to migrate their closed channels Afterwards, they'll be able to update to the (future) v0.14.x release once all of their pre-anchor channels have been closed.
t-bast
added a commit
that referenced
this pull request
Oct 27, 2025
We require closed channels to be migrated to the closed channels table introduced in #3170 before starting `eclair`. This ensures that we will not lose channel data when removing support for non-anchor channels in the next release. Node operators will have to: - run the v0.13.0 release to migrate their channel data to v5 - run the v0.13.1 release to migrate their closed channels Afterwards, they'll be able to update to the (future) v0.14.x release once all of their pre-anchor channels have been closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We create a dedicated table to store minimal information about closed channels. We migrate the existing closed channels to this new table. Note that we need to remove the foreign key constraint on
htlc_infosbecause that table is asynchronously cleaned up, which may happen after we moved the channel to the closed table (which is fine).There are several benefits to using a dedicated table and data class for closed channels. First of all, this is good for performance, because it doesn't impact the active channels table, and we only keep relevant data (the rest can be re-computed using the blockchain if necessary). Also, this is useful to allow removing data from
Commitmentsin the future, without needing to care for backwards-compatibility with very old channels (for example, removing supporting for theDefaultCommitmentFormatin favor of anchor outputs).