graph: update proof by ID

This commit restricts the graph CRUD interface such that one can only
add a proof to a channel announcement and not update any other fields.
This pattern is better suited for SQL land too.
This commit is contained in:
Elle Mouton committed 2025-02-18 11:05:28 -03:00
1 parent e58abbf0e5
commit 9df8773163
3 files changed
+15 -27

No files matched your search

+1 -8
View File
@@ -1441,14 +1441,7 @@ func (b *Builder) ForAllOutgoingChannels(cb func(*models.ChannelEdgeInfo,
func (b *Builder) AddProof(chanID lnwire.ShortChannelID,
proof *models.ChannelAuthProof) error {
info, _, _, err := b.cfg.Graph.FetchChannelEdgesByID(chanID.ToUint64())
if err != nil {
return err
}
info.AuthProof = proof
return b.cfg.Graph.UpdateChannelEdge(info)
return b.cfg.Graph.AddEdgeProof(chanID, proof)
}
// IsStaleNode returns true if the graph source has a node announcement for the