From 7f4c42847cefe85f80b830a331851a3d56c0a1dd Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Fri, 5 Jul 2019 09:34:45 +0200 Subject: [PATCH] lnrpc/routerrpc: create mission control interface --- lnrpc/routerrpc/router_backend.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 0d949909..7d51e251 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -42,7 +42,7 @@ type RouterBackend struct { amt lnwire.MilliSatoshi, restrictions *routing.RestrictParams, finalExpiry ...uint16) (*route.Route, error) - MissionControl *routing.MissionControl + MissionControl MissionControl // ActiveNetParams are the network parameters of the primary network // that the route is operating on. This is necessary so we can ensure @@ -55,6 +55,22 @@ type RouterBackend struct { Tower routing.ControlTower } +// MissionControl defines the mission control dependencies of routerrpc. +type MissionControl interface { + // GetEdgeProbability is expected to return the success probability of a payment + // from fromNode along edge. + GetEdgeProbability(fromNode route.Vertex, + edge routing.EdgeLocator, amt lnwire.MilliSatoshi) float64 + + // ResetHistory resets the history of MissionControl returning it to a state as + // if no payment attempts have been made. + ResetHistory() + + // GetHistorySnapshot takes a snapshot from the current mission control state + // and actual probability estimates. + GetHistorySnapshot() *routing.MissionControlSnapshot +} + // QueryRoutes attempts to query the daemons' Channel Router for a possible // route to a target destination capable of carrying a specific amount of // satoshis within the route's flow. The retuned route contains the full