Merge pull request #11335 from ziggie1984/channeldb-remove-dead-v6-deserializer
What changed, and why it matters
This commit simply deletes an unused, deprecated helper function that was only kept around for old database migrations. Removing dead code does not change how the program behaves or introduce a security issue.
No security action needed; treat as routine code cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes deserializeCloseChannelSummaryV6 from channeldb/legacy_serialization.go. The function was marked deprecated and intended only for migration. No call sites are removed, indicating it was already unused. The change is a code-cleanup deletion with no functional or security effect.
Changed components
channeldb/legacy_serialization.goInspect captured patch +0 / −64
### channeldb/legacy_serialization.go
@@ -1,64 +0,0 @@
-package channeldb
-
-import (
- "errors"
- "io"
-
- "github.com/btcsuite/btcd/btcec/v2"
- "github.com/lightningnetwork/lnd/fn/v2"
-)
-
-// deserializeCloseChannelSummaryV6 reads the v6 database format for
-// ChannelCloseSummary.
-//
-// NOTE: deprecated, only for migration.
-func deserializeCloseChannelSummaryV6(r io.Reader) (*ChannelCloseSummary, error) {
- c := &ChannelCloseSummary{}
-
- err := ReadElements(r,
- &c.ChanPoint, &c.ShortChanID, &c.ChainHash, &c.ClosingTXID,
- &c.CloseHeight, &c.RemotePub, &c.Capacity, &c.SettledBalance,
- &c.TimeLockedBalance, &c.CloseType, &c.IsPending,
- )
- if err != nil {
- return nil, err
- }
-
- // We'll now check to see if the channel close summary was encoded with
- // any of the additional optional fields.
- err = ReadElements(r, &c.RemoteCurrentRevocation)
- switch {
- case err == io.EOF:
- return c, nil
-
- // If we got a non-eof error, then we know there's an actually issue.
- // Otherwise, it may have been the case that this summary didn't have
- // the set of optional fields.
- case err != nil:
- return nil, err
- }
-
- if err := readChanConfig(r, &c.LocalChanConfig); err != nil {
- return nil, err
- }
-
- // Finally, we'll attempt to read the next unrevoked commitment point
- // for the remote party. If we closed the channel before receiving a
- // channel_ready message, then this can be nil. As a result, we'll use
- // the same technique to read the field, only if there's still data
- // left in the buffer.
- var nextRevocation *btcec.PublicKey
- err = ReadElements(r, &nextRevocation)
- switch {
- case err == nil:
- c.RemoteNextRevocation = fn.Some(*nextRevocation)
-
- // If we got a non-eof error, then we know there's an actually issue.
- // Otherwise, it may have been the case that this summary didn't have
- // the set of optional fields.
- case !errors.Is(err, io.EOF):
- return nil, err
- }
-
- return c, nil
-}Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.