mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 20:03:34 +02:00
multi: use new AdditionalEdge interface.
In the previous commit the AdditionalEdge interface was introduced with both of its implementations `BlindedEdge` and `PrivateEdge`. In both cases where we append a route either by a blinded route section or private route hints we now use these new types. In addition the `PayloadSizeFunc` type is introduced in the `unifiedEdge` struct. This is necessary to have the payload size function at hand when searching for a route hence not overshooting the max sphinx package size of 1300 bytes.
This commit is contained in:
@@ -95,9 +95,9 @@ func (m *SessionSource) NewPaymentSessionEmpty() PaymentSession {
|
||||
// RouteHintsToEdges converts a list of invoice route hints to an edge map that
|
||||
// can be passed into pathfinding.
|
||||
func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
|
||||
map[route.Vertex][]*models.CachedEdgePolicy, error) {
|
||||
map[route.Vertex][]AdditionalEdge, error) {
|
||||
|
||||
edges := make(map[route.Vertex][]*models.CachedEdgePolicy)
|
||||
edges := make(map[route.Vertex][]AdditionalEdge)
|
||||
|
||||
// Traverse through all of the available hop hints and include them in
|
||||
// our edges map, indexed by the public key of the channel's starting
|
||||
@@ -127,7 +127,7 @@ func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
|
||||
// Finally, create the channel edge from the hop hint
|
||||
// and add it to list of edges corresponding to the node
|
||||
// at the start of the channel.
|
||||
edge := &models.CachedEdgePolicy{
|
||||
edgePolicy := &models.CachedEdgePolicy{
|
||||
ToNodePubKey: func() route.Vertex {
|
||||
return endNode.PubKeyBytes
|
||||
},
|
||||
@@ -142,6 +142,10 @@ func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
|
||||
TimeLockDelta: hopHint.CLTVExpiryDelta,
|
||||
}
|
||||
|
||||
edge := &PrivateEdge{
|
||||
policy: edgePolicy,
|
||||
}
|
||||
|
||||
v := route.NewVertex(hopHint.NodeID)
|
||||
edges[v] = append(edges[v], edge)
|
||||
}
|
||||
|
Reference in New Issue
Block a user