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.
This commit is contained in:
7 files changed
+57
-51
No files matched your search
@@ -163,9 +163,10 @@ func queryMissionControl(ctx *cli.Context) error {
|
|||||||
var queryProbCommand = cli.Command{
|
var queryProbCommand = cli.Command{
|
||||||
Name: "queryprob",
|
Name: "queryprob",
|
||||||
Category: "Mission Control",
|
Category: "Mission Control",
|
||||||
Usage: "Estimate a success probability.",
|
Usage: "Deprecated. Estimate a success probability.",
|
||||||
ArgsUsage: "from-node to-node amt",
|
ArgsUsage: "from-node to-node amt",
|
||||||
Action: actionDecorator(queryProb),
|
Action: actionDecorator(queryProb),
|
||||||
|
Hidden: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func queryProb(ctx *cli.Context) error {
|
func queryProb(ctx *cli.Context) error {
|
||||||
|
|||||||
@@ -77,6 +77,9 @@
|
|||||||
GetBlock, GetBestBlock, GetBlockHash. These endpoints provide access to chain
|
GetBlock, GetBestBlock, GetBlockHash. These endpoints provide access to chain
|
||||||
block data.
|
block data.
|
||||||
|
|
||||||
|
* [`QueryProbabiltiy` is deprecated. Internal mission control state can be
|
||||||
|
obtained via `QueryMissionControl`.](
|
||||||
|
https://github.com/lightningnetwork/lnd/pull/6857)
|
||||||
|
|
||||||
## Wallet
|
## Wallet
|
||||||
|
|
||||||
@@ -262,8 +265,8 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
|
|||||||
|
|
||||||
## Pathfinding
|
## Pathfinding
|
||||||
|
|
||||||
* [Pathfinding takes capacity of edges into account to better estimate the
|
* [Pathfinding takes capacity of edges into account to improve success
|
||||||
success probability.](https://github.com/lightningnetwork/lnd/pull/6857)
|
probability estimation.](https://github.com/lightningnetwork/lnd/pull/6857)
|
||||||
|
|
||||||
### Tooling and documentation
|
### Tooling and documentation
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ service Router {
|
|||||||
returns (SetMissionControlConfigResponse);
|
returns (SetMissionControlConfigResponse);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QueryProbability returns the current success probability estimate for a
|
Deprecated. QueryProbability returns the current success probability
|
||||||
given node pair and amount.
|
estimate for a given node pair and amount.
|
||||||
*/
|
*/
|
||||||
rpc QueryProbability (QueryProbabilityRequest)
|
rpc QueryProbability (QueryProbabilityRequest)
|
||||||
returns (QueryProbabilityResponse);
|
returns (QueryProbabilityResponse);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
},
|
},
|
||||||
"/v2/router/mc/probability/{from_node}/{to_node}/{amt_msat}": {
|
"/v2/router/mc/probability/{from_node}/{to_node}/{amt_msat}": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "QueryProbability returns the current success probability estimate for a\ngiven node pair and amount.",
|
"summary": "Deprecated. QueryProbability returns the current success probability\nestimate for a given node pair and amount.",
|
||||||
"operationId": "Router_QueryProbability",
|
"operationId": "Router_QueryProbability",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ type RouterClient interface {
|
|||||||
// SetMissionControlConfig will set mission control's config, if the config
|
// SetMissionControlConfig will set mission control's config, if the config
|
||||||
// provided is valid.
|
// provided is valid.
|
||||||
SetMissionControlConfig(ctx context.Context, in *SetMissionControlConfigRequest, opts ...grpc.CallOption) (*SetMissionControlConfigResponse, error)
|
SetMissionControlConfig(ctx context.Context, in *SetMissionControlConfigRequest, opts ...grpc.CallOption) (*SetMissionControlConfigResponse, error)
|
||||||
// QueryProbability returns the current success probability estimate for a
|
// Deprecated. QueryProbability returns the current success probability
|
||||||
// given node pair and amount.
|
// estimate for a given node pair and amount.
|
||||||
QueryProbability(ctx context.Context, in *QueryProbabilityRequest, opts ...grpc.CallOption) (*QueryProbabilityResponse, error)
|
QueryProbability(ctx context.Context, in *QueryProbabilityRequest, opts ...grpc.CallOption) (*QueryProbabilityResponse, error)
|
||||||
// BuildRoute builds a fully specified route based on a list of hop public
|
// BuildRoute builds a fully specified route based on a list of hop public
|
||||||
// keys. It retrieves the relevant channel policies from the graph in order to
|
// keys. It retrieves the relevant channel policies from the graph in order to
|
||||||
@@ -483,8 +483,8 @@ type RouterServer interface {
|
|||||||
// SetMissionControlConfig will set mission control's config, if the config
|
// SetMissionControlConfig will set mission control's config, if the config
|
||||||
// provided is valid.
|
// provided is valid.
|
||||||
SetMissionControlConfig(context.Context, *SetMissionControlConfigRequest) (*SetMissionControlConfigResponse, error)
|
SetMissionControlConfig(context.Context, *SetMissionControlConfigRequest) (*SetMissionControlConfigResponse, error)
|
||||||
// QueryProbability returns the current success probability estimate for a
|
// Deprecated. QueryProbability returns the current success probability
|
||||||
// given node pair and amount.
|
// estimate for a given node pair and amount.
|
||||||
QueryProbability(context.Context, *QueryProbabilityRequest) (*QueryProbabilityResponse, error)
|
QueryProbability(context.Context, *QueryProbabilityRequest) (*QueryProbabilityResponse, error)
|
||||||
// BuildRoute builds a fully specified route based on a list of hop public
|
// BuildRoute builds a fully specified route based on a list of hop public
|
||||||
// keys. It retrieves the relevant channel policies from the graph in order to
|
// keys. It retrieves the relevant channel policies from the graph in order to
|
||||||
|
|||||||
@@ -692,47 +692,6 @@ func getMsatPairValue(msatValue lnwire.MilliSatoshi,
|
|||||||
satValue)
|
satValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryProbability returns the current success probability estimate for a
|
|
||||||
// given node pair and amount.
|
|
||||||
func (s *Server) QueryProbability(ctx context.Context,
|
|
||||||
req *QueryProbabilityRequest) (*QueryProbabilityResponse, error) {
|
|
||||||
|
|
||||||
fromNode, err := route.NewVertexFromBytes(req.FromNode)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
toNode, err := route.NewVertexFromBytes(req.ToNode)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
amt := lnwire.MilliSatoshi(req.AmtMsat)
|
|
||||||
|
|
||||||
// Compute the probability.
|
|
||||||
var prob float64
|
|
||||||
mc := s.cfg.RouterBackend.MissionControl
|
|
||||||
capacity, err := s.cfg.RouterBackend.FetchAmountPairCapacity(
|
|
||||||
fromNode, toNode, amt,
|
|
||||||
)
|
|
||||||
|
|
||||||
// If we cannot query the capacity this means that either we don't have
|
|
||||||
// information available or that the channel fails min/maxHtlc
|
|
||||||
// constraints, so we return a zero probability.
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot fetch capacity: %v", err)
|
|
||||||
} else {
|
|
||||||
prob = mc.GetProbability(fromNode, toNode, amt, capacity)
|
|
||||||
}
|
|
||||||
|
|
||||||
history := mc.GetPairHistorySnapshot(fromNode, toNode)
|
|
||||||
|
|
||||||
return &QueryProbabilityResponse{
|
|
||||||
Probability: prob,
|
|
||||||
History: toRPCPairData(&history),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TrackPaymentV2 returns a stream of payment state updates. The stream is
|
// TrackPaymentV2 returns a stream of payment state updates. The stream is
|
||||||
// closed when the payment completes.
|
// closed when the payment completes.
|
||||||
func (s *Server) TrackPaymentV2(request *TrackPaymentRequest,
|
func (s *Server) TrackPaymentV2(request *TrackPaymentRequest,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacyTrackPaymentServer is a wrapper struct that transforms a stream of main
|
// legacyTrackPaymentServer is a wrapper struct that transforms a stream of main
|
||||||
@@ -118,3 +120,44 @@ func (s *Server) SendToRoute(ctx context.Context,
|
|||||||
|
|
||||||
return legacyResp, err
|
return legacyResp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryProbability returns the current success probability estimate for a
|
||||||
|
// given node pair and amount.
|
||||||
|
func (s *Server) QueryProbability(ctx context.Context,
|
||||||
|
req *QueryProbabilityRequest) (*QueryProbabilityResponse, error) {
|
||||||
|
|
||||||
|
fromNode, err := route.NewVertexFromBytes(req.FromNode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
toNode, err := route.NewVertexFromBytes(req.ToNode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
amt := lnwire.MilliSatoshi(req.AmtMsat)
|
||||||
|
|
||||||
|
// Compute the probability.
|
||||||
|
var prob float64
|
||||||
|
mc := s.cfg.RouterBackend.MissionControl
|
||||||
|
capacity, err := s.cfg.RouterBackend.FetchAmountPairCapacity(
|
||||||
|
fromNode, toNode, amt,
|
||||||
|
)
|
||||||
|
|
||||||
|
// If we cannot query the capacity this means that either we don't have
|
||||||
|
// information available or that the channel fails min/maxHtlc
|
||||||
|
// constraints, so we return a zero probability.
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Cannot fetch capacity: %v", err)
|
||||||
|
} else {
|
||||||
|
prob = mc.GetProbability(fromNode, toNode, amt, capacity)
|
||||||
|
}
|
||||||
|
|
||||||
|
history := mc.GetPairHistorySnapshot(fromNode, toNode)
|
||||||
|
|
||||||
|
return &QueryProbabilityResponse{
|
||||||
|
Probability: prob,
|
||||||
|
History: toRPCPairData(&history),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
Reference in new issue
Block a user