Skip to content

Commit

Permalink
routing: add the option to set the income node or channel on blinded …
Browse files Browse the repository at this point in the history
…path
  • Loading branch information
MPins committed Oct 12, 2024
1 parent fdff391 commit adc5c80
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions routing/pathfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,14 @@ type blindedPathRestrictions struct {
// nodeOmissionSet holds a set of node IDs of nodes that we should
// ignore during blinded path selection.
nodeOmissionSet fn.Set[route.Vertex]

// nodeIncomeSet holds a set of node IDs of nodes that we should
// use as income hope during blinded path selection.
nodeIncomeSet fn.Set[route.Vertex]

// channelIncomeSet holds a set of channel IDs of channels that we
// should use as income channel during blinded path selection.
channelIncomeSet fn.Set[uint64]
}

// blindedHop holds the information about a hop we have selected for a blinded
Expand Down Expand Up @@ -1274,6 +1282,15 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
return nil, false, nil
}

// If we have explicity been told to consider this node as the
// income hope.
if !restrictions.nodeIncomeSet.IsEmpty() {

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run macOS itest

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set["github.com/lightningnetwork/lnd/routing/route".Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (neutrino, backend=neutrino cover=1)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-notxindex, backend="bitcoind notxindex")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling" cover=1)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind, backend=bitcoind cover=1)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (btcd, backend=btcd cover=1)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / lint code

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / lint code

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run windows itest

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (btcd unit-cover)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (btcd unit-cover)

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)

Check failure on line 1287 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

restrictions.nodeIncomeSet.IsEmpty undefined (type fn.Set[route.Vertex] has no field or method IsEmpty)
if len(alreadyVisited) == 1 &&
!restrictions.nodeIncomeSet.Contains(node) {
return nil, false, nil
}
}

supports, err := supportsRouteBlinding(node)
if err != nil {
return nil, false, err
Expand All @@ -1300,6 +1317,16 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
// node that can be used for blinded paths
err = g.ForEachNodeChannel(node,
func(channel *channeldb.DirectedChannel) error {
// If we have explicity been told to consider this
// channel as the income hope.
channelIncomeSet := restrictions.channelIncomeSet
if !channelIncomeSet.IsEmpty() {

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run macOS itest

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (neutrino, backend=neutrino cover=1)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-notxindex, backend="bitcoind notxindex")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling" cover=1)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind, backend=bitcoind cover=1)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (btcd, backend=btcd cover=1)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run ubuntu itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / lint code

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)) (typecheck)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / lint code

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)) (typecheck)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run windows itest

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (btcd unit-cover)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (btcd unit-cover)

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)

Check failure on line 1323 in routing/pathfind.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

channelIncomeSet.IsEmpty undefined (type fn.Set[uint64] has no field or method IsEmpty)
if len(alreadyVisited) == 0 &&
!channelIncomeSet.Contains(channel.ChannelID) {
return nil
}
}

// Keep track of how many incoming channels this node
// has. We only use a node as an introduction node if it
// has channels other than the one that lead us to it.
Expand Down

0 comments on commit adc5c80

Please sign in to comment.