Skip to content

Commit 2d7fda2

Browse files
committed
routerrpc: mark QueryProbability deprecated
We deprecate `QueryProbability`, as it displays the same information as `QueryMissionControl` less the probability. `QueryRoutes` still contains the total probability of a route.
1 parent 1dd7a37 commit 2d7fda2

File tree

7 files changed

+57
-51
lines changed

7 files changed

+57
-51
lines changed

cmd/lncli/cmd_mission_control.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ func queryMissionControl(ctx *cli.Context) error {
163163
var queryProbCommand = cli.Command{
164164
Name: "queryprob",
165165
Category: "Mission Control",
166-
Usage: "Estimate a success probability.",
166+
Usage: "Deprecated. Estimate a success probability.",
167167
ArgsUsage: "from-node to-node amt",
168168
Action: actionDecorator(queryProb),
169+
Hidden: true,
169170
}
170171

171172
func queryProb(ctx *cli.Context) error {

docs/release-notes/release-notes-0.16.0.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
GetBlock, GetBestBlock, GetBlockHash. These endpoints provide access to chain
7878
block data.
7979

80+
* [`QueryProbabiltiy` is deprecated. Internal mission control state can be
81+
obtained via `QueryMissionControl`.](
82+
https://github.com/lightningnetwork/lnd/pull/6857)
8083

8184
## Wallet
8285

@@ -262,8 +265,8 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
262265

263266
## Pathfinding
264267

265-
* [Pathfinding takes capacity of edges into account to better estimate the
266-
success probability.](https://github.com/lightningnetwork/lnd/pull/6857)
268+
* [Pathfinding takes capacity of edges into account to improve success
269+
probability estimation.](https://github.com/lightningnetwork/lnd/pull/6857)
267270

268271
### Tooling and documentation
269272

lnrpc/routerrpc/router.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ service Router {
9494
returns (SetMissionControlConfigResponse);
9595

9696
/*
97-
QueryProbability returns the current success probability estimate for a
98-
given node pair and amount.
97+
Deprecated. QueryProbability returns the current success probability
98+
estimate for a given node pair and amount.
9999
*/
100100
rpc QueryProbability (QueryProbabilityRequest)
101101
returns (QueryProbabilityResponse);

lnrpc/routerrpc/router.swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
},
117117
"/v2/router/mc/probability/{from_node}/{to_node}/{amt_msat}": {
118118
"get": {
119-
"summary": "QueryProbability returns the current success probability estimate for a\ngiven node pair and amount.",
119+
"summary": "Deprecated. QueryProbability returns the current success probability\nestimate for a given node pair and amount.",
120120
"operationId": "Router_QueryProbability",
121121
"responses": {
122122
"200": {

lnrpc/routerrpc/router_grpc.pb.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/routerrpc/router_server.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -692,47 +692,6 @@ func getMsatPairValue(msatValue lnwire.MilliSatoshi,
692692
satValue)
693693
}
694694

695-
// QueryProbability returns the current success probability estimate for a
696-
// given node pair and amount.
697-
func (s *Server) QueryProbability(ctx context.Context,
698-
req *QueryProbabilityRequest) (*QueryProbabilityResponse, error) {
699-
700-
fromNode, err := route.NewVertexFromBytes(req.FromNode)
701-
if err != nil {
702-
return nil, err
703-
}
704-
705-
toNode, err := route.NewVertexFromBytes(req.ToNode)
706-
if err != nil {
707-
return nil, err
708-
}
709-
710-
amt := lnwire.MilliSatoshi(req.AmtMsat)
711-
712-
// Compute the probability.
713-
var prob float64
714-
mc := s.cfg.RouterBackend.MissionControl
715-
capacity, err := s.cfg.RouterBackend.FetchAmountPairCapacity(
716-
fromNode, toNode, amt,
717-
)
718-
719-
// If we cannot query the capacity this means that either we don't have
720-
// information available or that the channel fails min/maxHtlc
721-
// constraints, so we return a zero probability.
722-
if err != nil {
723-
log.Errorf("Cannot fetch capacity: %v", err)
724-
} else {
725-
prob = mc.GetProbability(fromNode, toNode, amt, capacity)
726-
}
727-
728-
history := mc.GetPairHistorySnapshot(fromNode, toNode)
729-
730-
return &QueryProbabilityResponse{
731-
Probability: prob,
732-
History: toRPCPairData(&history),
733-
}, nil
734-
}
735-
736695
// TrackPaymentV2 returns a stream of payment state updates. The stream is
737696
// closed when the payment completes.
738697
func (s *Server) TrackPaymentV2(request *TrackPaymentRequest,

lnrpc/routerrpc/router_server_deprecated.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"fmt"
88

99
"github.com/lightningnetwork/lnd/lnrpc"
10+
"github.com/lightningnetwork/lnd/lnwire"
11+
"github.com/lightningnetwork/lnd/routing/route"
1012
)
1113

1214
// legacyTrackPaymentServer is a wrapper struct that transforms a stream of main
@@ -118,3 +120,44 @@ func (s *Server) SendToRoute(ctx context.Context,
118120

119121
return legacyResp, err
120122
}
123+
124+
// QueryProbability returns the current success probability estimate for a
125+
// given node pair and amount.
126+
func (s *Server) QueryProbability(ctx context.Context,
127+
req *QueryProbabilityRequest) (*QueryProbabilityResponse, error) {
128+
129+
fromNode, err := route.NewVertexFromBytes(req.FromNode)
130+
if err != nil {
131+
return nil, err
132+
}
133+
134+
toNode, err := route.NewVertexFromBytes(req.ToNode)
135+
if err != nil {
136+
return nil, err
137+
}
138+
139+
amt := lnwire.MilliSatoshi(req.AmtMsat)
140+
141+
// Compute the probability.
142+
var prob float64
143+
mc := s.cfg.RouterBackend.MissionControl
144+
capacity, err := s.cfg.RouterBackend.FetchAmountPairCapacity(
145+
fromNode, toNode, amt,
146+
)
147+
148+
// If we cannot query the capacity this means that either we don't have
149+
// information available or that the channel fails min/maxHtlc
150+
// constraints, so we return a zero probability.
151+
if err != nil {
152+
log.Errorf("Cannot fetch capacity: %v", err)
153+
} else {
154+
prob = mc.GetProbability(fromNode, toNode, amt, capacity)
155+
}
156+
157+
history := mc.GetPairHistorySnapshot(fromNode, toNode)
158+
159+
return &QueryProbabilityResponse{
160+
Probability: prob,
161+
History: toRPCPairData(&history),
162+
}, nil
163+
}

0 commit comments

Comments
 (0)