Skip to content
Open
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3265d86
tools: use new golang 1.24 tool directive
ziggie1984 Sep 15, 2025
8dc48a9
tools: update golangci-lint to v2
ziggie1984 Sep 15, 2025
7b0b9b6
linter: remove unsupported linters from the codebase
ziggie1984 Sep 15, 2025
76d0250
CI: also use go tool for gosimports
ziggie1984 Sep 15, 2025
8f0a1dd
CI: remove unnecessary custom-gcl.yml file
ziggie1984 Sep 19, 2025
b977ba8
makefile: add linter config check
ziggie1984 Sep 19, 2025
80b98fd
lnwire: add NodeAnnouncement interface
ellemouton Sep 15, 2025
750ac7c
lnwire: define GossipVersion and GossipMessage
ellemouton Sep 15, 2025
5fc1e37
lnwire: let gossip messages implement GossipMessage
ellemouton Sep 15, 2025
e6e5f29
graph/db: use lnwire.GossipVersion instead of ProtocolVersion
ellemouton Sep 15, 2025
cbe5a5f
discovery: let reject cache use gossip version in key
ellemouton Sep 15, 2025
a0aad14
mulit: don't set customData on the lnrpc route level
ziggie1984 Sep 30, 2025
7f3a19c
paymentsdb: make verifyAttempt more robust
ziggie1984 Sep 30, 2025
b17a49f
lnwire: add onion message type
gijswijs May 14, 2025
08d9685
lnrpc: SendOnionMessage rpc endpoint
gijswijs May 22, 2025
6b16813
multi: endpoints for onion messages
gijswijs May 26, 2025
2bcf09e
chore: thread context through to SendCustomMessage
gijswijs Sep 25, 2025
6a1ea92
docs: update release notes for 0.21.0
gijswijs Oct 7, 2025
490587d
models: simplify models.Node
ellemouton Sep 4, 2025
7882b9b
multi: remove HaveNodeAnnouncement field from Node
ellemouton Sep 4, 2025
f2865f3
multi: add models.Node V1 constructor
ellemouton Sep 4, 2025
255471c
graph/db: simplify auth proof and edge info
ellemouton Sep 4, 2025
30e53b2
graph: remove DB interface
ellemouton Sep 16, 2025
6fcdbbb
graph/db: remove outdated comment
ellemouton Sep 15, 2025
1c3685f
graph/db: remove TestPopulateViaMigration
ellemouton Nov 6, 2025
323c336
multi: freeze graph SQL migration logic
ellemouton Nov 2, 2025
dc134c0
go.mod: replace local sqldb
ellemouton Nov 2, 2025
058e188
graph/db: freeze sql migration queries
ellemouton Nov 2, 2025
2c9b47f
docs: update release notes
ellemouton Nov 3, 2025
706b22a
Merge pull request #10338 from ellemouton/graphSQLMigFreeze
ellemouton Nov 9, 2025
00690cc
devrpc: fix comment
ellemouton Oct 29, 2025
c149db4
sqldb: add new gossip v2 columns to graph tables
ellemouton Nov 3, 2025
d54c54d
graph/db: rename V1Store to Store
ellemouton Nov 3, 2025
f733f6c
graph/db: add V2 Node constructor
ellemouton Oct 26, 2025
ab2cd65
sqldb: update node query for v2
ellemouton Oct 26, 2025
2cc17fd
graph/db: explicit redirect to Store
ellemouton Oct 26, 2025
2115261
graph/db: allow v2 nodes
ellemouton Oct 26, 2025
d714da5
graph/db: split HasNode into two methods
ellemouton Oct 26, 2025
1410779
graph/db: move gossip versions up one layer
ellemouton Oct 26, 2025
4bc6f92
graph/db: add helper variable for tests
ellemouton Oct 26, 2025
f114ba0
graph/db: introduce VersionedReader
ellemouton Oct 26, 2025
bd8f180
graph/db: let node helpers take version
ellemouton Oct 26, 2025
807a0ea
graph/db: test V2 node CRUD
ellemouton Oct 26, 2025
46ce8ab
graph/db: convert other node CRUD methods
ellemouton Oct 26, 2025
989e778
docs: update release notes
ellemouton Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 45 additions & 13 deletions graph/db/sql_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3471,22 +3471,38 @@ func buildNode(ctx context.Context, cfg *sqldb.QueryConfig, db SQLQueries,
return buildNodeWithBatchData(dbNode, data)
}

// isKnownGossipVersion checks whether the provided gossip version is known
// and supported.
func isKnownGossipVersion(v lnwire.GossipVersion) bool {
switch v {
case lnwire.GossipVersion1:
return true
case lnwire.GossipVersion2:
return true
default:
return false
}
}

// buildNodeWithBatchData builds a models.Node instance
// from the provided sqlc.GraphNode and batchNodeData. If the node does have
// features/addresses/extra fields, then the corresponding fields are expected
// to be present in the batchNodeData.
func buildNodeWithBatchData(dbNode sqlc.GraphNode,
batchData *batchNodeData) (*models.Node, error) {

if dbNode.Version != int16(lnwire.GossipVersion1) {
return nil, fmt.Errorf("unsupported node version: %d",
dbNode.Version)
v := lnwire.GossipVersion(dbNode.Version)

if !isKnownGossipVersion(v) {
return nil, fmt.Errorf("unknown node version: %d", v)
}

var pub [33]byte
copy(pub[:], dbNode.PubKey)
pub, err := route.NewVertexFromBytes(dbNode.PubKey)
if err != nil {
return nil, fmt.Errorf("unable to parse pubkey: %w", err)
}

node := models.NewV1ShellNode(pub)
node := models.NewShellNode(v, pub)

if len(dbNode.Signature) == 0 {
return node, nil
Expand All @@ -3500,8 +3516,10 @@ func buildNodeWithBatchData(dbNode sqlc.GraphNode,
if dbNode.LastUpdate.Valid {
node.LastUpdate = time.Unix(dbNode.LastUpdate.Int64, 0)
}
if dbNode.BlockHeight.Valid {
node.LastBlockHeight = uint32(dbNode.BlockHeight.Int64)
}

var err error
if dbNode.Color.Valid {
nodeColor, err := DecodeHexColor(dbNode.Color.String)
if err != nil {
Expand Down Expand Up @@ -3539,7 +3557,11 @@ func buildNodeWithBatchData(dbNode sqlc.GraphNode,
"signed fields: %w", err)
}
if len(recs) != 0 {
node.ExtraOpaqueData = recs
if v == lnwire.GossipVersion1 {
node.ExtraOpaqueData = recs
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like the default serialization is of the v1 data could be expensive, maybe there's a way around it?

Perhaps we could add a comment to ExtraOpaqueData's docstring to mention it's only used for v1 nodes as well.

} else {
node.ExtraSignedFields = extraFields
}
}
}

Expand Down Expand Up @@ -3606,8 +3628,12 @@ func getNodeFeatures(ctx context.Context, db SQLQueries,
func upsertNode(ctx context.Context, db SQLQueries,
node *models.Node) (int64, error) {

if !isKnownGossipVersion(node.Version) {
return 0, fmt.Errorf("unknown gossip version: %d", node.Version)
}

params := sqlc.UpsertNodeParams{
Version: int16(lnwire.GossipVersion1),
Version: int16(node.Version),
PubKey: node.PubKeyBytes[:],
}

Expand All @@ -3619,6 +3645,9 @@ func upsertNode(ctx context.Context, db SQLQueries,
)

case lnwire.GossipVersion2:
params.BlockHeight = sqldb.SQLInt64(
int32(node.LastBlockHeight),
)

default:
return 0, fmt.Errorf("unknown gossip version: %d",
Expand Down Expand Up @@ -3660,10 +3689,13 @@ func upsertNode(ctx context.Context, db SQLQueries,

// Convert the flat extra opaque data into a map of TLV types to
// values.
extra, err := marshalExtraOpaqueData(node.ExtraOpaqueData)
if err != nil {
return 0, fmt.Errorf("unable to marshal extra opaque data: %w",
err)
extra := node.ExtraSignedFields
if node.Version == lnwire.GossipVersion1 {
extra, err = marshalExtraOpaqueData(node.ExtraOpaqueData)
if err != nil {
return 0, fmt.Errorf("unable to marshal extra opaque "+
"data: %w", err)
}
}

// Update the node's extra signed fields.
Expand Down