multi: remove kvdb.RTx from ForEachNodeChannel

Since we have not removed all call-sites that make use of this
parameter, we can remove it. This helps hide DB-specific details from
the interface we will introduce for the graph store.
This commit is contained in:
Elle Mouton committed 2025-05-22 14:14:39 +02:00
1 parent 3ec4798311
commit da3deeee7c
7 files changed
+18 -20

No files matched your search

+3 -4
View File
@@ -1141,7 +1141,7 @@ func TestGraphTraversal(t *testing.T) {
numNodeChans := 0
firstNode, secondNode := nodeList[0], nodeList[1]
err = graph.ForEachNodeChannel(firstNode.PubKeyBytes,
func(_ kvdb.RTx, _ *models.ChannelEdgeInfo, outEdge,
func(_ *models.ChannelEdgeInfo, outEdge,
inEdge *models.ChannelEdgePolicy) error {
// All channels between first and second node should
@@ -2882,7 +2882,7 @@ func TestIncompleteChannelPolicies(t *testing.T) {
calls := 0
err := graph.ForEachNodeChannel(node.PubKeyBytes,
func(_ kvdb.RTx, _ *models.ChannelEdgeInfo, outEdge,
func(_ *models.ChannelEdgeInfo, outEdge,
inEdge *models.ChannelEdgePolicy) error {
if !expectedOut && outEdge != nil {
@@ -4001,8 +4001,7 @@ func BenchmarkForEachChannel(b *testing.B) {
require.NoError(b, err)
for _, n := range nodes {
cb := func(tx kvdb.RTx,
info *models.ChannelEdgeInfo,
cb := func(info *models.ChannelEdgeInfo,
policy *models.ChannelEdgePolicy,
policy2 *models.ChannelEdgePolicy) error { //nolint:ll
+7 -2
View File
@@ -3103,10 +3103,15 @@ func nodeTraversal(tx kvdb.RTx, nodePub []byte, db kvdb.Backend,
//
// Unknown policies are passed into the callback as nil values.
func (c *KVStore) ForEachNodeChannel(nodePub route.Vertex,
cb func(kvdb.RTx, *models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
cb func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy) error) error {
return nodeTraversal(nil, nodePub[:], c.db, cb)
return nodeTraversal(nil, nodePub[:], c.db, func(_ kvdb.RTx,
info *models.ChannelEdgeInfo, policy,
policy2 *models.ChannelEdgePolicy) error {
return cb(info, policy, policy2)
})
}
// ForEachSourceNodeChannel iterates through all channels of the source node,