Skip to content

Conversation

@t-bast
Copy link
Member

@t-bast t-bast commented Sep 16, 2025

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_infos because 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 Commitments in the future, without needing to care for backwards-compatibility with very old channels (for example, removing supporting for the DefaultCommitmentFormat in favor of anchor outputs).

@t-bast
Copy link
Member Author

t-bast commented Sep 17, 2025

Rebased on master without conflicts.

thomash-acinq
thomash-acinq previously approved these changes Sep 23, 2025
Copy link
Member

@pm47 pm47 left a 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.

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`.
@t-bast t-bast force-pushed the closed-channel-data branch from 54f27b7 to 2636a7e Compare September 26, 2025 09:16
@t-bast t-bast merged commit 16a309e into master Sep 30, 2025
1 check passed
@t-bast t-bast deleted the closed-channel-data branch September 30, 2025 09:21
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants