graph/db: let GraphCache.AddChannel take cached edge polies

So that the call-sites of this method dont necessarily need to fetch all
the data required to populate the full ChannelEdgePolicy.
This commit is contained in:
Elle Mouton committed 2025-06-10 20:10:35 +02:00
1 parent f95588caca
commit 3ea86bfbf4
3 files changed
+27 -22

No files matched your search

+10 -2
View File
@@ -177,7 +177,11 @@ func (c *ChannelGraph) populateCache() error {
err = c.V1Store.ForEachChannel(func(info *models.ChannelEdgeInfo,
policy1, policy2 *models.ChannelEdgePolicy) error {
c.graphCache.AddChannel(info, policy1, policy2)
c.graphCache.AddChannel(
info,
models.NewCachedPolicy(policy1),
models.NewCachedPolicy(policy2),
)
return nil
})
@@ -347,7 +351,11 @@ func (c *ChannelGraph) MarkEdgeLive(chanID uint64) error {
info := infos[0]
c.graphCache.AddChannel(info.Info, info.Policy1, info.Policy2)
c.graphCache.AddChannel(
info.Info,
models.NewCachedPolicy(info.Policy1),
models.NewCachedPolicy(info.Policy2),
)
}
return nil