Skip to content
Draft
Changes from all commits
Commits
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
22 changes: 15 additions & 7 deletions graph/db/graph_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,9 @@
return
}

if policy1 != nil && policy1.IsDisabled() &&
policy2 != nil && policy2.IsDisabled() {

return
}

// Create the edge entry for both nodes.
// Create the edge entry for both nodes. We always add the channel
// structure to the cache, even if both policies are currently disabled,
// so that later policy updates can find and update the channel entry.
c.mtx.Lock()
c.updateOrAddEdge(info.NodeKey1Bytes, &DirectedChannel{
ChannelID: info.ChannelID,
Expand All @@ -143,6 +139,18 @@
})
c.mtx.Unlock()

// Skip adding policies if both are disabled, as the channel is
// currently unusable for routing. However, we still add the channel
// structure above so that policy updates can later enable it.
if policy1 != nil && policy1.IsDisabled() &&
policy2 != nil && policy2.IsDisabled() {

log.Debugf("Skipping policies for channel %v: both "+
"policies are disabled (channel structure still "+
"cached for future updates)", info.ChannelID)
return

Check failure on line 151 in graph/db/graph_cache.go

View workflow job for this annotation

GitHub Actions / Lint code

return with no blank line before (nlreturn)
}

// The policy's node is always the to_node. So if policy 1 has to_node
// of node 2 then we have the policy 1 as seen from node 1.
if policy1 != nil {
Expand Down
Loading