What changed, and why it matters
This is a small internal code cleanup in LND's channel gossip subsystem. It changes which internal data type the gossiper uses when looking up a channel, switching from a database-specific type to a newer channel-state type. There is no user-facing behavior change and no security fix.
No security action required. Treat as ordinary refactoring/review for correctness and compilation.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors the FindChannel callback in discovery/gossiper.go and its test mock from returning *channeldb.OpenChannel to returning *chanstate.OpenChannel. It is purely a type-alias/compatibility removal at the boundary between the discovery package and channel state storage. The commit message explicitly states this only removes the channeldb compatibility alias from the channel state lookup boundary and that discovery still depends on channeldb for waiting-proof persistence.
Changed components
discovery/gossiper.godiscovery/gossiper_test.goInspect captured patch +4 / −2
diff --git a/discovery/gossiper.go b/discovery/gossiper.go
index 615dd7c..7f08742 100644
--- a/discovery/gossiper.go
+++ b/discovery/gossiper.go
@@ -26,6 +26,7 @@ import (
"github.com/lightningnetwork/lnd/batch"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/graph"
graphdb "github.com/lightningnetwork/lnd/graph/db"
@@ -384,7 +385,7 @@ type Config struct {
// FindChannel allows the gossiper to find a channel that we're party
// to without iterating over the entire set of open channels.
FindChannel func(node *btcec.PublicKey, chanID lnwire.ChannelID) (
- *channeldb.OpenChannel, error)
+ *chanstate.OpenChannel, error)
// IsStillZombieChannel returns true if the channel described by info
// should still be considered a zombie.
diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go
index f9151ed..eb045e8 100644
--- a/discovery/gossiper_test.go
+++ b/discovery/gossiper_test.go
@@ -27,6 +27,7 @@ import (
"github.com/lightningnetwork/lnd/batch"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/graph"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/graph/db/models"
@@ -889,7 +890,7 @@ func (ctx *testCtx) createChannelAnnouncement(blockHeight uint32, key1,
}
func mockFindChannel(node *btcec.PublicKey, chanID lnwire.ChannelID) (
- *channeldb.OpenChannel, error) {
+ *chanstate.OpenChannel, error) {
return nil, 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.