mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
routing: use routingGraph interface in payment session
Preparation for more test coverage of payment session. The function findPath now has the call signature of the former findPathInternal function.
This commit is contained in:
@ -13,10 +13,11 @@ func TestRequestRoute(t *testing.T) {
|
||||
height = 10
|
||||
)
|
||||
|
||||
findPath := func(g *graphParams, r *RestrictParams,
|
||||
cfg *PathFindingConfig, source, target route.Vertex,
|
||||
amt lnwire.MilliSatoshi, finalHtlcExpiry int32) (
|
||||
[]*channeldb.ChannelEdgePolicy, error) {
|
||||
findPath := func(
|
||||
g *graphParams,
|
||||
r *RestrictParams, cfg *PathFindingConfig,
|
||||
source, target route.Vertex, amt lnwire.MilliSatoshi,
|
||||
finalHtlcExpiry int32) ([]*channeldb.ChannelEdgePolicy, error) {
|
||||
|
||||
// We expect find path to receive a cltv limit excluding the
|
||||
// final cltv delta (including the block padding).
|
||||
@ -37,13 +38,6 @@ func TestRequestRoute(t *testing.T) {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
sessionSource := &SessionSource{
|
||||
SelfNode: &channeldb.LightningNode{},
|
||||
MissionControl: &MissionControl{
|
||||
cfg: &MissionControlConfig{},
|
||||
},
|
||||
}
|
||||
|
||||
cltvLimit := uint32(30)
|
||||
finalCltvDelta := uint16(8)
|
||||
|
||||
@ -60,9 +54,14 @@ func TestRequestRoute(t *testing.T) {
|
||||
|
||||
return nil, nil
|
||||
},
|
||||
sessionSource: sessionSource,
|
||||
payment: payment,
|
||||
pathFinder: findPath,
|
||||
payment: payment,
|
||||
pathFinder: findPath,
|
||||
missionControl: &MissionControl{
|
||||
cfg: &MissionControlConfig{},
|
||||
},
|
||||
getRoutingGraph: func() (routingGraph, func(), error) {
|
||||
return &sessionGraph{}, func() {}, nil
|
||||
},
|
||||
}
|
||||
|
||||
route, err := session.RequestRoute(
|
||||
@ -79,3 +78,11 @@ func TestRequestRoute(t *testing.T) {
|
||||
route.TotalTimeLock)
|
||||
}
|
||||
}
|
||||
|
||||
type sessionGraph struct {
|
||||
routingGraph
|
||||
}
|
||||
|
||||
func (g *sessionGraph) sourceNode() route.Vertex {
|
||||
return route.Vertex{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user