Merge pull request #3556 from joostjager/query-mc-prob

routerrpc: add queryprob rpc
This commit is contained in:
Joost Jager 2019-10-31 08:03:29 +01:00 committed by GitHub
commit fcf81ed8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 582 additions and 204 deletions

@ -48,9 +48,9 @@ func queryMissionControl(ctx *cli.Context) error {
displayPairHistory{ displayPairHistory{
NodeFrom: hex.EncodeToString(n.NodeFrom), NodeFrom: hex.EncodeToString(n.NodeFrom),
NodeTo: hex.EncodeToString(n.NodeTo), NodeTo: hex.EncodeToString(n.NodeTo),
LastAttemptSuccessful: n.LastAttemptSuccessful, LastAttemptSuccessful: n.History.LastAttemptSuccessful,
Timestamp: n.Timestamp, Timestamp: n.History.Timestamp,
MinPenalizeAmtSat: n.MinPenalizeAmtSat, MinPenalizeAmtSat: n.History.MinPenalizeAmtSat,
}, },
) )
} }

@ -0,0 +1,70 @@
// +build routerrpc
package main
import (
"context"
"fmt"
"strconv"
"github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/urfave/cli"
)
var queryProbCommand = cli.Command{
Name: "queryprob",
Category: "Payments",
Usage: "Estimate a success probability.",
ArgsUsage: "from-node to-node amt",
Action: actionDecorator(queryProb),
}
func queryProb(ctx *cli.Context) error {
args := ctx.Args()
if len(args) != 3 {
return cli.ShowCommandHelp(ctx, "queryprob")
}
fromNode, err := route.NewVertexFromStr(args.Get(0))
if err != nil {
return fmt.Errorf("invalid from node key: %v", err)
}
toNode, err := route.NewVertexFromStr(args.Get(1))
if err != nil {
return fmt.Errorf("invalid to node key: %v", err)
}
amtSat, err := strconv.ParseUint(args.Get(2), 10, 64)
if err != nil {
return fmt.Errorf("invalid amt: %v", err)
}
amtMsat := lnwire.NewMSatFromSatoshis(
btcutil.Amount(amtSat),
)
conn := getClientConn(ctx, false)
defer conn.Close()
client := routerrpc.NewRouterClient(conn)
req := &routerrpc.QueryProbabilityRequest{
FromNode: fromNode[:],
ToNode: toNode[:],
AmtMsat: int64(amtMsat),
}
rpcCtx := context.Background()
response, err := client.QueryProbability(rpcCtx, req)
if err != nil {
return err
}
printJSON(response)
return nil
}

@ -8,6 +8,7 @@ import "github.com/urfave/cli"
func routerCommands() []cli.Command { func routerCommands() []cli.Command {
return []cli.Command{ return []cli.Command{
queryMissionControlCommand, queryMissionControlCommand,
queryProbCommand,
resetMissionControlCommand, resetMissionControlCommand,
buildRouteCommand, buildRouteCommand,
} }

@ -1050,16 +1050,11 @@ type PairHistory struct {
/// The source node pubkey of the pair. /// The source node pubkey of the pair.
NodeFrom []byte `protobuf:"bytes,1,opt,name=node_from,proto3" json:"node_from,omitempty"` NodeFrom []byte `protobuf:"bytes,1,opt,name=node_from,proto3" json:"node_from,omitempty"`
/// The destination node pubkey of the pair. /// The destination node pubkey of the pair.
NodeTo []byte `protobuf:"bytes,2,opt,name=node_to,proto3" json:"node_to,omitempty"` NodeTo []byte `protobuf:"bytes,2,opt,name=node_to,proto3" json:"node_to,omitempty"`
/// Time stamp of last result. History *PairData `protobuf:"bytes,7,opt,name=history,proto3" json:"history,omitempty"`
Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
/// Minimum penalization amount (only applies to failed attempts). XXX_unrecognized []byte `json:"-"`
MinPenalizeAmtSat int64 `protobuf:"varint,4,opt,name=min_penalize_amt_sat,proto3" json:"min_penalize_amt_sat,omitempty"` XXX_sizecache int32 `json:"-"`
/// Whether the last payment attempt through this pair was successful.
LastAttemptSuccessful bool `protobuf:"varint,6,opt,name=last_attempt_successful,proto3" json:"last_attempt_successful,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *PairHistory) Reset() { *m = PairHistory{} } func (m *PairHistory) Reset() { *m = PairHistory{} }
@ -1101,27 +1096,178 @@ func (m *PairHistory) GetNodeTo() []byte {
return nil return nil
} }
func (m *PairHistory) GetTimestamp() int64 { func (m *PairHistory) GetHistory() *PairData {
if m != nil {
return m.History
}
return nil
}
type PairData struct {
/// Time stamp of last result.
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
/// Minimum penalization amount (only applies to failed attempts).
MinPenalizeAmtSat int64 `protobuf:"varint,2,opt,name=min_penalize_amt_sat,proto3" json:"min_penalize_amt_sat,omitempty"`
/// Whether the last payment attempt through this pair was successful.
LastAttemptSuccessful bool `protobuf:"varint,3,opt,name=last_attempt_successful,proto3" json:"last_attempt_successful,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PairData) Reset() { *m = PairData{} }
func (m *PairData) String() string { return proto.CompactTextString(m) }
func (*PairData) ProtoMessage() {}
func (*PairData) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{14}
}
func (m *PairData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PairData.Unmarshal(m, b)
}
func (m *PairData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PairData.Marshal(b, m, deterministic)
}
func (m *PairData) XXX_Merge(src proto.Message) {
xxx_messageInfo_PairData.Merge(m, src)
}
func (m *PairData) XXX_Size() int {
return xxx_messageInfo_PairData.Size(m)
}
func (m *PairData) XXX_DiscardUnknown() {
xxx_messageInfo_PairData.DiscardUnknown(m)
}
var xxx_messageInfo_PairData proto.InternalMessageInfo
func (m *PairData) GetTimestamp() int64 {
if m != nil { if m != nil {
return m.Timestamp return m.Timestamp
} }
return 0 return 0
} }
func (m *PairHistory) GetMinPenalizeAmtSat() int64 { func (m *PairData) GetMinPenalizeAmtSat() int64 {
if m != nil { if m != nil {
return m.MinPenalizeAmtSat return m.MinPenalizeAmtSat
} }
return 0 return 0
} }
func (m *PairHistory) GetLastAttemptSuccessful() bool { func (m *PairData) GetLastAttemptSuccessful() bool {
if m != nil { if m != nil {
return m.LastAttemptSuccessful return m.LastAttemptSuccessful
} }
return false return false
} }
type QueryProbabilityRequest struct {
/// The source node pubkey of the pair.
FromNode []byte `protobuf:"bytes,1,opt,name=from_node,proto3" json:"from_node,omitempty"`
/// The destination node pubkey of the pair.
ToNode []byte `protobuf:"bytes,2,opt,name=to_node,proto3" json:"to_node,omitempty"`
/// The amount for which to calculate a probability.
AmtMsat int64 `protobuf:"varint,3,opt,name=amt_msat,proto3" json:"amt_msat,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *QueryProbabilityRequest) Reset() { *m = QueryProbabilityRequest{} }
func (m *QueryProbabilityRequest) String() string { return proto.CompactTextString(m) }
func (*QueryProbabilityRequest) ProtoMessage() {}
func (*QueryProbabilityRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{15}
}
func (m *QueryProbabilityRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryProbabilityRequest.Unmarshal(m, b)
}
func (m *QueryProbabilityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryProbabilityRequest.Marshal(b, m, deterministic)
}
func (m *QueryProbabilityRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryProbabilityRequest.Merge(m, src)
}
func (m *QueryProbabilityRequest) XXX_Size() int {
return xxx_messageInfo_QueryProbabilityRequest.Size(m)
}
func (m *QueryProbabilityRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryProbabilityRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryProbabilityRequest proto.InternalMessageInfo
func (m *QueryProbabilityRequest) GetFromNode() []byte {
if m != nil {
return m.FromNode
}
return nil
}
func (m *QueryProbabilityRequest) GetToNode() []byte {
if m != nil {
return m.ToNode
}
return nil
}
func (m *QueryProbabilityRequest) GetAmtMsat() int64 {
if m != nil {
return m.AmtMsat
}
return 0
}
type QueryProbabilityResponse struct {
/// The success probability for the requested pair.
Probability float64 `protobuf:"fixed64,1,opt,name=probability,proto3" json:"probability,omitempty"`
/// The historical data for the requested pair.
History *PairData `protobuf:"bytes,2,opt,name=history,proto3" json:"history,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *QueryProbabilityResponse) Reset() { *m = QueryProbabilityResponse{} }
func (m *QueryProbabilityResponse) String() string { return proto.CompactTextString(m) }
func (*QueryProbabilityResponse) ProtoMessage() {}
func (*QueryProbabilityResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{16}
}
func (m *QueryProbabilityResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryProbabilityResponse.Unmarshal(m, b)
}
func (m *QueryProbabilityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryProbabilityResponse.Marshal(b, m, deterministic)
}
func (m *QueryProbabilityResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryProbabilityResponse.Merge(m, src)
}
func (m *QueryProbabilityResponse) XXX_Size() int {
return xxx_messageInfo_QueryProbabilityResponse.Size(m)
}
func (m *QueryProbabilityResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryProbabilityResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryProbabilityResponse proto.InternalMessageInfo
func (m *QueryProbabilityResponse) GetProbability() float64 {
if m != nil {
return m.Probability
}
return 0
}
func (m *QueryProbabilityResponse) GetHistory() *PairData {
if m != nil {
return m.History
}
return nil
}
type BuildRouteRequest struct { type BuildRouteRequest struct {
//* //*
//The amount to send expressed in msat. If set to zero, the minimum routable //The amount to send expressed in msat. If set to zero, the minimum routable
@ -1148,7 +1294,7 @@ func (m *BuildRouteRequest) Reset() { *m = BuildRouteRequest{} }
func (m *BuildRouteRequest) String() string { return proto.CompactTextString(m) } func (m *BuildRouteRequest) String() string { return proto.CompactTextString(m) }
func (*BuildRouteRequest) ProtoMessage() {} func (*BuildRouteRequest) ProtoMessage() {}
func (*BuildRouteRequest) Descriptor() ([]byte, []int) { func (*BuildRouteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{14} return fileDescriptor_7a0613f69d37b0a5, []int{17}
} }
func (m *BuildRouteRequest) XXX_Unmarshal(b []byte) error { func (m *BuildRouteRequest) XXX_Unmarshal(b []byte) error {
@ -1210,7 +1356,7 @@ func (m *BuildRouteResponse) Reset() { *m = BuildRouteResponse{} }
func (m *BuildRouteResponse) String() string { return proto.CompactTextString(m) } func (m *BuildRouteResponse) String() string { return proto.CompactTextString(m) }
func (*BuildRouteResponse) ProtoMessage() {} func (*BuildRouteResponse) ProtoMessage() {}
func (*BuildRouteResponse) Descriptor() ([]byte, []int) { func (*BuildRouteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{15} return fileDescriptor_7a0613f69d37b0a5, []int{18}
} }
func (m *BuildRouteResponse) XXX_Unmarshal(b []byte) error { func (m *BuildRouteResponse) XXX_Unmarshal(b []byte) error {
@ -1256,6 +1402,9 @@ func init() {
proto.RegisterType((*QueryMissionControlRequest)(nil), "routerrpc.QueryMissionControlRequest") proto.RegisterType((*QueryMissionControlRequest)(nil), "routerrpc.QueryMissionControlRequest")
proto.RegisterType((*QueryMissionControlResponse)(nil), "routerrpc.QueryMissionControlResponse") proto.RegisterType((*QueryMissionControlResponse)(nil), "routerrpc.QueryMissionControlResponse")
proto.RegisterType((*PairHistory)(nil), "routerrpc.PairHistory") proto.RegisterType((*PairHistory)(nil), "routerrpc.PairHistory")
proto.RegisterType((*PairData)(nil), "routerrpc.PairData")
proto.RegisterType((*QueryProbabilityRequest)(nil), "routerrpc.QueryProbabilityRequest")
proto.RegisterType((*QueryProbabilityResponse)(nil), "routerrpc.QueryProbabilityResponse")
proto.RegisterType((*BuildRouteRequest)(nil), "routerrpc.BuildRouteRequest") proto.RegisterType((*BuildRouteRequest)(nil), "routerrpc.BuildRouteRequest")
proto.RegisterType((*BuildRouteResponse)(nil), "routerrpc.BuildRouteResponse") proto.RegisterType((*BuildRouteResponse)(nil), "routerrpc.BuildRouteResponse")
} }
@ -1263,120 +1412,128 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) } func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{ var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 1805 bytes of a gzipped FileDescriptorProto // 1931 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4f, 0x73, 0x1a, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x58, 0x4f, 0x73, 0x22, 0xc7,
0x15, 0xdf, 0x11, 0x20, 0xe0, 0x01, 0xd2, 0xa8, 0x25, 0xcb, 0x63, 0x64, 0xad, 0xb5, 0xec, 0x66, 0x15, 0xf7, 0x08, 0x10, 0xf0, 0x00, 0x69, 0xd4, 0x92, 0xb5, 0xb3, 0x48, 0xf2, 0xca, 0xb3, 0x8e,
0x57, 0xe5, 0x72, 0x24, 0x47, 0xa9, 0xdd, 0x72, 0xed, 0x21, 0x29, 0x0c, 0xcd, 0x6a, 0x6c, 0x98, 0xad, 0xda, 0x5a, 0x4b, 0x1b, 0x52, 0x76, 0x6d, 0xf9, 0x90, 0x14, 0x0b, 0x83, 0x35, 0x5a, 0x18,
0x91, 0x1b, 0xf0, 0xae, 0x93, 0x43, 0x57, 0x1b, 0x5a, 0x62, 0x4a, 0xc3, 0x0c, 0x3b, 0xd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0x90, 0x38,
0xb6, 0x36, 0x82, 0xdd, 0x35, 0x1c, 0x8a, 0x7e, 0x95, 0xf6, 0xe0, 0x41, 0x06, 0xae, 0x7e, 0xf9,
0x4b, 0x6a, 0x8b, 0x53, 0xd6, 0x90, 0xed, 0xd2, 0x29, 0x0f, 0x53, 0xf5, 0xd2, 0x29, 0x1f, 0xe3,
0xec, 0x9f, 0x40, 0x5f, 0x6d, 0x74, 0x64, 0xae, 0xee, 0xbd, 0x4f, 0x3a, 0xd5, 0xa7, 0x1f, 0xd5,
0x89, 0x8d, 0xdb, 0x00, 0x8b, 0x76, 0x41, 0x87, 0xa9, 0x2d, 0xf7, 0xda, 0xbd, 0x7a, 0xf4, 0x80,
0x54, 0x99, 0x7a, 0xf5, 0xeb, 0xdf, 0x9f, 0xdd, 0xb8, 0x7c, 0x3c, 0xbb, 0x3a, 0x1d, 0x06, 0x93,
0x33, 0x4f, 0x0c, 0xd5, 0xbe, 0xeb, 0xdf, 0xf8, 0x8c, 0xff, 0x21, 0x08, 0x6f, 0xcf, 0x3c, 0x7f,
0x74, 0x26, 0xbb, 0xee, 0x6c, 0x6e, 0xe5, 0x6a, 0x53, 0xfe, 0x7f, 0xe3, 0x37, 0xff, 0x0b, 0x00,
0x00, 0xff, 0xff, 0x1d, 0x08, 0x9a, 0xb8, 0x0f, 0x11, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -1418,6 +1575,10 @@ type RouterClient interface {
//It is a development feature. //It is a development feature.
QueryMissionControl(ctx context.Context, in *QueryMissionControlRequest, opts ...grpc.CallOption) (*QueryMissionControlResponse, error) QueryMissionControl(ctx context.Context, in *QueryMissionControlRequest, opts ...grpc.CallOption) (*QueryMissionControlResponse, error)
//* //*
//QueryProbability returns the current success probability estimate for a
//given node pair and amount.
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
//calculate the correct fees and time locks. //calculate the correct fees and time locks.
@ -1532,6 +1693,15 @@ func (c *routerClient) QueryMissionControl(ctx context.Context, in *QueryMission
return out, nil return out, nil
} }
func (c *routerClient) QueryProbability(ctx context.Context, in *QueryProbabilityRequest, opts ...grpc.CallOption) (*QueryProbabilityResponse, error) {
out := new(QueryProbabilityResponse)
err := c.cc.Invoke(ctx, "/routerrpc.Router/QueryProbability", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *routerClient) BuildRoute(ctx context.Context, in *BuildRouteRequest, opts ...grpc.CallOption) (*BuildRouteResponse, error) { func (c *routerClient) BuildRoute(ctx context.Context, in *BuildRouteRequest, opts ...grpc.CallOption) (*BuildRouteResponse, error) {
out := new(BuildRouteResponse) out := new(BuildRouteResponse)
err := c.cc.Invoke(ctx, "/routerrpc.Router/BuildRoute", in, out, opts...) err := c.cc.Invoke(ctx, "/routerrpc.Router/BuildRoute", in, out, opts...)
@ -1570,6 +1740,10 @@ type RouterServer interface {
//It is a development feature. //It is a development feature.
QueryMissionControl(context.Context, *QueryMissionControlRequest) (*QueryMissionControlResponse, error) QueryMissionControl(context.Context, *QueryMissionControlRequest) (*QueryMissionControlResponse, error)
//* //*
//QueryProbability returns the current success probability estimate for a
//given node pair and amount.
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
//calculate the correct fees and time locks. //calculate the correct fees and time locks.
@ -1694,6 +1868,24 @@ func _Router_QueryMissionControl_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Router_QueryProbability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProbabilityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RouterServer).QueryProbability(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/routerrpc.Router/QueryProbability",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RouterServer).QueryProbability(ctx, req.(*QueryProbabilityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Router_BuildRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Router_BuildRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BuildRouteRequest) in := new(BuildRouteRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -1732,6 +1924,10 @@ var _Router_serviceDesc = grpc.ServiceDesc{
MethodName: "QueryMissionControl", MethodName: "QueryMissionControl",
Handler: _Router_QueryMissionControl_Handler, Handler: _Router_QueryMissionControl_Handler,
}, },
{
MethodName: "QueryProbability",
Handler: _Router_QueryProbability_Handler,
},
{ {
MethodName: "BuildRoute", MethodName: "BuildRoute",
Handler: _Router_BuildRoute_Handler, Handler: _Router_BuildRoute_Handler,

@ -351,16 +351,39 @@ message PairHistory {
/// The destination node pubkey of the pair. /// The destination node pubkey of the pair.
bytes node_to = 2 [json_name="node_to"]; bytes node_to = 2 [json_name="node_to"];
reserved 3, 4, 5, 6;
PairData history = 7 [json_name="history"];
}
message PairData {
/// Time stamp of last result. /// Time stamp of last result.
int64 timestamp = 3 [json_name = "timestamp"]; int64 timestamp = 1 [json_name = "timestamp"];
/// Minimum penalization amount (only applies to failed attempts). /// Minimum penalization amount (only applies to failed attempts).
int64 min_penalize_amt_sat = 4 [json_name = "min_penalize_amt_sat"]; int64 min_penalize_amt_sat = 2 [json_name = "min_penalize_amt_sat"];
reserved 5;
/// Whether the last payment attempt through this pair was successful. /// Whether the last payment attempt through this pair was successful.
bool last_attempt_successful = 6 [json_name = "last_attempt_successful"]; bool last_attempt_successful = 3 [json_name = "last_attempt_successful"];
}
message QueryProbabilityRequest{
/// The source node pubkey of the pair.
bytes from_node = 1 [json_name = "from_node"];
/// The destination node pubkey of the pair.
bytes to_node = 2 [json_name = "to_node"];
/// The amount for which to calculate a probability.
int64 amt_msat = 3 [json_name = "amt_msat"];
}
message QueryProbabilityResponse{
/// The success probability for the requested pair.
double probability = 1 [json_name = "probability"];
/// The historical data for the requested pair.
PairData history = 2 [json_name = "history"];
} }
message BuildRouteRequest { message BuildRouteRequest {
@ -436,6 +459,12 @@ service Router {
*/ */
rpc QueryMissionControl(QueryMissionControlRequest) returns (QueryMissionControlResponse); rpc QueryMissionControl(QueryMissionControlRequest) returns (QueryMissionControlResponse);
/**
QueryProbability returns the current success probability estimate for a
given node pair and amount.
*/
rpc QueryProbability(QueryProbabilityRequest) returns (QueryProbabilityResponse);
/** /**
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

@ -76,6 +76,11 @@ type MissionControl interface {
// GetHistorySnapshot takes a snapshot from the current mission control // GetHistorySnapshot takes a snapshot from the current mission control
// state and actual probability estimates. // state and actual probability estimates.
GetHistorySnapshot() *routing.MissionControlSnapshot GetHistorySnapshot() *routing.MissionControlSnapshot
// GetPairHistorySnapshot returns the stored history for a given node
// pair.
GetPairHistorySnapshot(fromNode,
toNode route.Vertex) routing.TimedPairResult
} }
// QueryRoutes attempts to query the daemons' Channel Router for a possible // QueryRoutes attempts to query the daemons' Channel Router for a possible

@ -174,3 +174,9 @@ func (m *mockMissionControl) ResetHistory() error {
func (m *mockMissionControl) GetHistorySnapshot() *routing.MissionControlSnapshot { func (m *mockMissionControl) GetHistorySnapshot() *routing.MissionControlSnapshot {
return nil return nil
} }
func (m *mockMissionControl) GetPairHistorySnapshot(fromNode,
toNode route.Vertex) routing.TimedPairResult {
return routing.TimedPairResult{}
}

@ -68,6 +68,10 @@ var (
Entity: "offchain", Entity: "offchain",
Action: "read", Action: "read",
}}, }},
"/routerrpc.Router/QueryProbability": {{
Entity: "offchain",
Action: "read",
}},
"/routerrpc.Router/ResetMissionControl": {{ "/routerrpc.Router/ResetMissionControl": {{
Entity: "offchain", Entity: "offchain",
Action: "write", Action: "write",
@ -472,13 +476,9 @@ func (s *Server) QueryMissionControl(ctx context.Context,
pair := p pair := p
rpcPair := PairHistory{ rpcPair := PairHistory{
NodeFrom: pair.Pair.From[:], NodeFrom: pair.Pair.From[:],
NodeTo: pair.Pair.To[:], NodeTo: pair.Pair.To[:],
Timestamp: pair.Timestamp.Unix(), History: toRPCPairData(&pair.TimedPairResult),
MinPenalizeAmtSat: int64(
pair.MinPenalizeAmt.ToSatoshis(),
),
LastAttemptSuccessful: pair.LastAttemptSuccessful,
} }
rpcPairs = append(rpcPairs, &rpcPair) rpcPairs = append(rpcPairs, &rpcPair)
@ -491,6 +491,49 @@ func (s *Server) QueryMissionControl(ctx context.Context,
return &response, nil return &response, nil
} }
// toRPCPairData marshalls mission control pair data to the rpc struct.
func toRPCPairData(data *routing.TimedPairResult) *PairData {
rpcData := PairData{
MinPenalizeAmtSat: int64(
data.MinPenalizeAmt.ToSatoshis(),
),
LastAttemptSuccessful: data.Success,
}
if !data.Timestamp.IsZero() {
rpcData.Timestamp = data.Timestamp.Unix()
}
return &rpcData
}
// 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)
mc := s.cfg.RouterBackend.MissionControl
prob := mc.GetProbability(fromNode, toNode, amt)
history := mc.GetPairHistorySnapshot(fromNode, toNode)
return &QueryProbabilityResponse{
Probability: prob,
History: toRPCPairData(&history),
}, nil
}
// TrackPayment returns a stream of payment state updates. The stream is // TrackPayment returns a stream of payment state updates. The stream is
// closed when the payment completes. // closed when the payment completes.
func (s *Server) TrackPayment(request *TrackPaymentRequest, func (s *Server) TrackPayment(request *TrackPaymentRequest,

@ -53,7 +53,7 @@ const (
) )
// NodeResults contains previous results from a node to its peers. // NodeResults contains previous results from a node to its peers.
type NodeResults map[route.Vertex]timedPairResult type NodeResults map[route.Vertex]TimedPairResult
// MissionControl contains state which summarizes the past attempts of HTLC // MissionControl contains state which summarizes the past attempts of HTLC
// routing by external callers when sending payments throughout the network. It // routing by external callers when sending payments throughout the network. It
@ -120,12 +120,29 @@ type MissionControlConfig struct {
AprioriWeight float64 AprioriWeight float64
} }
// timedPairResult describes a timestamped pair result. // TimedPairResult describes a timestamped pair result.
type timedPairResult struct { type TimedPairResult struct {
// timestamp is the time when this result was obtained. // timestamp is the time when this result was obtained.
timestamp time.Time Timestamp time.Time
pairResult // minPenalizeAmt is the minimum amount for which a penalty should be
// applied based on this result. Only applies to fail results.
MinPenalizeAmt lnwire.MilliSatoshi
// success indicates whether the payment attempt was successful through
// this pair.
Success bool
}
// newTimedPairResult wraps a pair result with a timestamp.
func newTimedPairResult(timestamp time.Time,
result pairResult) TimedPairResult {
return TimedPairResult{
Timestamp: timestamp,
MinPenalizeAmt: result.minPenalizeAmt,
Success: result.success,
}
} }
// MissionControlSnapshot contains a snapshot of the current state of mission // MissionControlSnapshot contains a snapshot of the current state of mission
@ -142,16 +159,8 @@ type MissionControlPairSnapshot struct {
// Pair is the node pair of which the state is described. // Pair is the node pair of which the state is described.
Pair DirectedNodePair Pair DirectedNodePair
// Timestamp is the time of last result. // TimedPairResult contains the data for this pair.
Timestamp time.Time TimedPairResult
// MinPenalizeAmt is the minimum amount for which the channel will be
// penalized.
MinPenalizeAmt lnwire.MilliSatoshi
// LastAttemptSuccessful indicates whether the last payment attempt
// through this pair was successful.
LastAttemptSuccessful bool
} }
// paymentResult is the information that becomes available when a payment // paymentResult is the information that becomes available when a payment
@ -257,7 +266,7 @@ func (m *MissionControl) GetProbability(fromNode, toNode route.Vertex,
// setLastPairResult stores a result for a node pair. // setLastPairResult stores a result for a node pair.
func (m *MissionControl) setLastPairResult(fromNode, func (m *MissionControl) setLastPairResult(fromNode,
toNode route.Vertex, result timedPairResult) { toNode route.Vertex, result TimedPairResult) {
nodePairs, ok := m.lastPairResult[fromNode] nodePairs, ok := m.lastPairResult[fromNode]
if !ok { if !ok {
@ -278,10 +287,9 @@ func (m *MissionControl) setAllFail(fromNode route.Vertex,
} }
for connection := range nodePairs { for connection := range nodePairs {
nodePairs[connection] = timedPairResult{ nodePairs[connection] = newTimedPairResult(
timestamp: timestamp, timestamp, failPairResult(0),
pairResult: failPairResult(0), )
}
} }
} }
@ -329,14 +337,11 @@ func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot {
for fromNode, fromPairs := range m.lastPairResult { for fromNode, fromPairs := range m.lastPairResult {
for toNode, result := range fromPairs { for toNode, result := range fromPairs {
pair := NewDirectedNodePair(fromNode, toNode) pair := NewDirectedNodePair(fromNode, toNode)
pairSnapshot := MissionControlPairSnapshot{ pairSnapshot := MissionControlPairSnapshot{
Pair: pair, Pair: pair,
MinPenalizeAmt: result.minPenalizeAmt, TimedPairResult: result,
Timestamp: result.timestamp,
LastAttemptSuccessful: result.success,
} }
pairs = append(pairs, pairSnapshot) pairs = append(pairs, pairSnapshot)
@ -350,6 +355,26 @@ func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot {
return &snapshot return &snapshot
} }
// GetPairHistorySnapshot returns the stored history for a given node pair.
func (m *MissionControl) GetPairHistorySnapshot(
fromNode, toNode route.Vertex) TimedPairResult {
m.Lock()
defer m.Unlock()
results, ok := m.lastPairResult[fromNode]
if !ok {
return TimedPairResult{}
}
result, ok := results[toNode]
if !ok {
return TimedPairResult{}
}
return result
}
// ReportPaymentFail reports a failed payment to mission control as input for // ReportPaymentFail reports a failed payment to mission control as input for
// future probability estimates. The failureSourceIdx argument indicates the // future probability estimates. The failureSourceIdx argument indicates the
// failure source. If it is nil, the failure source is unknown. This function // failure source. If it is nil, the failure source is unknown. This function
@ -468,10 +493,13 @@ func (m *MissionControl) applyPaymentResult(
pair, pairResult.minPenalizeAmt) pair, pairResult.minPenalizeAmt)
} }
m.setLastPairResult(pair.From, pair.To, timedPairResult{ m.setLastPairResult(
timestamp: result.timeReply, pair.From, pair.To,
pairResult: pairResult, newTimedPairResult(
}) result.timeReply,
pairResult,
),
)
} }
return i.finalFailureReason return i.finalFailureReason

@ -80,19 +80,19 @@ func (p *probabilityEstimator) getNodeProbability(now time.Time,
totalWeight := aprioriFactor totalWeight := aprioriFactor
for _, result := range results { for _, result := range results {
age := now.Sub(result.timestamp) age := now.Sub(result.Timestamp)
switch { switch {
// Weigh success with a constant high weight of 1. There is no // Weigh success with a constant high weight of 1. There is no
// decay. // decay.
case result.success: case result.Success:
totalWeight++ totalWeight++
probabilitiesTotal += p.prevSuccessProbability probabilitiesTotal += p.prevSuccessProbability
// Weigh failures in accordance with their age. The base // Weigh failures in accordance with their age. The base
// probability of a failure is considered zero, so nothing needs // probability of a failure is considered zero, so nothing needs
// to be added to probabilitiesTotal. // to be added to probabilitiesTotal.
case amt >= result.minPenalizeAmt: case amt >= result.MinPenalizeAmt:
totalWeight += p.getWeight(age) totalWeight += p.getWeight(age)
} }
} }
@ -127,7 +127,7 @@ func (p *probabilityEstimator) getPairProbability(
// For successes, we have a fixed (high) probability. Those pairs // For successes, we have a fixed (high) probability. Those pairs
// will be assumed good until proven otherwise. // will be assumed good until proven otherwise.
if lastPairResult.success { if lastPairResult.Success {
return p.prevSuccessProbability return p.prevSuccessProbability
} }
@ -138,11 +138,11 @@ func (p *probabilityEstimator) getPairProbability(
// penalization. If the current amount is smaller than the amount that // penalization. If the current amount is smaller than the amount that
// previously triggered a failure, we act as if this is an untried // previously triggered a failure, we act as if this is an untried
// channel. // channel.
if amt < lastPairResult.minPenalizeAmt { if amt < lastPairResult.MinPenalizeAmt {
return nodeProbability return nodeProbability
} }
timeSinceLastFailure := now.Sub(lastPairResult.timestamp) timeSinceLastFailure := now.Sub(lastPairResult.Timestamp)
// Calculate success probability based on the weight of the last // Calculate success probability based on the weight of the last
// failure. When the failure is fresh, its weight is 1 and we'll return // failure. When the failure is fresh, its weight is 1 and we'll return

@ -33,7 +33,7 @@ type estimatorTestContext struct {
// corresponds to the last result towards a node. The list index equals // corresponds to the last result towards a node. The list index equals
// the node id. So the first element in the list is the result towards // the node id. So the first element in the list is the result towards
// node 0. // node 0.
results map[int]timedPairResult results map[int]TimedPairResult
} }
func newEstimatorTestContext(t *testing.T) *estimatorTestContext { func newEstimatorTestContext(t *testing.T) *estimatorTestContext {
@ -83,11 +83,11 @@ func TestProbabilityEstimatorNoResults(t *testing.T) {
func TestProbabilityEstimatorOneSuccess(t *testing.T) { func TestProbabilityEstimatorOneSuccess(t *testing.T) {
ctx := newEstimatorTestContext(t) ctx := newEstimatorTestContext(t)
ctx.results = map[int]timedPairResult{ ctx.results = map[int]TimedPairResult{
node1: { node1: newTimedPairResult(
timestamp: testTime.Add(-time.Hour), testTime.Add(-time.Hour),
pairResult: successPairResult(), successPairResult(),
}, ),
} }
// Because of the previous success, this channel keep reporting a high // Because of the previous success, this channel keep reporting a high
@ -107,11 +107,11 @@ func TestProbabilityEstimatorOneSuccess(t *testing.T) {
func TestProbabilityEstimatorOneFailure(t *testing.T) { func TestProbabilityEstimatorOneFailure(t *testing.T) {
ctx := newEstimatorTestContext(t) ctx := newEstimatorTestContext(t)
ctx.results = map[int]timedPairResult{ ctx.results = map[int]TimedPairResult{
node1: { node1: newTimedPairResult(
timestamp: testTime.Add(-time.Hour), testTime.Add(-time.Hour),
pairResult: failPairResult(0), failPairResult(0),
}, ),
} }
// For an untried node, we expected the node probability. The weight for // For an untried node, we expected the node probability. The weight for
@ -130,19 +130,19 @@ func TestProbabilityEstimatorOneFailure(t *testing.T) {
func TestProbabilityEstimatorMix(t *testing.T) { func TestProbabilityEstimatorMix(t *testing.T) {
ctx := newEstimatorTestContext(t) ctx := newEstimatorTestContext(t)
ctx.results = map[int]timedPairResult{ ctx.results = map[int]TimedPairResult{
node1: { node1: newTimedPairResult(
timestamp: testTime.Add(-time.Hour), testTime.Add(-time.Hour),
pairResult: successPairResult(), successPairResult(),
}, ),
node2: { node2: newTimedPairResult(
timestamp: testTime.Add(-2 * time.Hour), testTime.Add(-2*time.Hour),
pairResult: failPairResult(0), failPairResult(0),
}, ),
node3: { node3: newTimedPairResult(
timestamp: testTime.Add(-3 * time.Hour), testTime.Add(-3*time.Hour),
pairResult: failPairResult(0), failPairResult(0),
}, ),
} }
// We expect the probability for a previously successful channel to // We expect the probability for a previously successful channel to