routerrpc: convert sendpayment to async

Modify the routerrpc SendPayment api to asynchronous. This allows
callers to pick up a payment after the rpc connection was lost or lnd
was restarted.
This commit is contained in:
Joost Jager 2019-03-22 10:21:25 +01:00
parent 07d289c14e
commit f03533c67a
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
8 changed files with 571 additions and 239 deletions

@ -97,6 +97,18 @@ const (
// TODO(halseth): cancel state. // TODO(halseth): cancel state.
) )
// String returns a human readable FailureReason
func (r FailureReason) String() string {
switch r {
case FailureReasonTimeout:
return "timeout"
case FailureReasonNoRoute:
return "no_route"
}
return "unknown"
}
// PaymentStatus represent current status of payment // PaymentStatus represent current status of payment
type PaymentStatus byte type PaymentStatus byte

@ -5,7 +5,6 @@ package routerrpc
import ( import (
"time" "time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/macaroons"

@ -23,6 +23,46 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type PaymentState int32
const (
//*
//Payment is still in flight.
PaymentState_IN_FLIGHT PaymentState = 0
//*
//Payment completed successfully.
PaymentState_SUCCEEDED PaymentState = 1
//*
//There are more routes to try, but the payment timeout was exceeded.
PaymentState_FAILED_TIMEOUT PaymentState = 2
//*
//All possible routes were tried and failed permanently. Or were no
//routes to the destination at all.
PaymentState_FAILED_NO_ROUTE PaymentState = 3
)
var PaymentState_name = map[int32]string{
0: "IN_FLIGHT",
1: "SUCCEEDED",
2: "FAILED_TIMEOUT",
3: "FAILED_NO_ROUTE",
}
var PaymentState_value = map[string]int32{
"IN_FLIGHT": 0,
"SUCCEEDED": 1,
"FAILED_TIMEOUT": 2,
"FAILED_NO_ROUTE": 3,
}
func (x PaymentState) String() string {
return proto.EnumName(PaymentState_name, int32(x))
}
func (PaymentState) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{0}
}
type Failure_FailureCode int32 type Failure_FailureCode int32
const ( const (
@ -109,10 +149,10 @@ func (x Failure_FailureCode) String() string {
} }
func (Failure_FailureCode) EnumDescriptor() ([]byte, []int) { func (Failure_FailureCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{6, 0} return fileDescriptor_7a0613f69d37b0a5, []int{7, 0}
} }
type PaymentRequest struct { type SendPaymentRequest struct {
/// The identity pubkey of the payment recipient /// The identity pubkey of the payment recipient
Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"` Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"`
/// Number of satoshis to send. /// Number of satoshis to send.
@ -155,154 +195,192 @@ type PaymentRequest struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *PaymentRequest) Reset() { *m = PaymentRequest{} } func (m *SendPaymentRequest) Reset() { *m = SendPaymentRequest{} }
func (m *PaymentRequest) String() string { return proto.CompactTextString(m) } func (m *SendPaymentRequest) String() string { return proto.CompactTextString(m) }
func (*PaymentRequest) ProtoMessage() {} func (*SendPaymentRequest) ProtoMessage() {}
func (*PaymentRequest) Descriptor() ([]byte, []int) { func (*SendPaymentRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{0} return fileDescriptor_7a0613f69d37b0a5, []int{0}
} }
func (m *PaymentRequest) XXX_Unmarshal(b []byte) error { func (m *SendPaymentRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PaymentRequest.Unmarshal(m, b) return xxx_messageInfo_SendPaymentRequest.Unmarshal(m, b)
} }
func (m *PaymentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SendPaymentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PaymentRequest.Marshal(b, m, deterministic) return xxx_messageInfo_SendPaymentRequest.Marshal(b, m, deterministic)
} }
func (m *PaymentRequest) XXX_Merge(src proto.Message) { func (m *SendPaymentRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_PaymentRequest.Merge(m, src) xxx_messageInfo_SendPaymentRequest.Merge(m, src)
} }
func (m *PaymentRequest) XXX_Size() int { func (m *SendPaymentRequest) XXX_Size() int {
return xxx_messageInfo_PaymentRequest.Size(m) return xxx_messageInfo_SendPaymentRequest.Size(m)
} }
func (m *PaymentRequest) XXX_DiscardUnknown() { func (m *SendPaymentRequest) XXX_DiscardUnknown() {
xxx_messageInfo_PaymentRequest.DiscardUnknown(m) xxx_messageInfo_SendPaymentRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_PaymentRequest proto.InternalMessageInfo var xxx_messageInfo_SendPaymentRequest proto.InternalMessageInfo
func (m *PaymentRequest) GetDest() []byte { func (m *SendPaymentRequest) GetDest() []byte {
if m != nil { if m != nil {
return m.Dest return m.Dest
} }
return nil return nil
} }
func (m *PaymentRequest) GetAmt() int64 { func (m *SendPaymentRequest) GetAmt() int64 {
if m != nil { if m != nil {
return m.Amt return m.Amt
} }
return 0 return 0
} }
func (m *PaymentRequest) GetPaymentHash() []byte { func (m *SendPaymentRequest) GetPaymentHash() []byte {
if m != nil { if m != nil {
return m.PaymentHash return m.PaymentHash
} }
return nil return nil
} }
func (m *PaymentRequest) GetFinalCltvDelta() int32 { func (m *SendPaymentRequest) GetFinalCltvDelta() int32 {
if m != nil { if m != nil {
return m.FinalCltvDelta return m.FinalCltvDelta
} }
return 0 return 0
} }
func (m *PaymentRequest) GetPaymentRequest() string { func (m *SendPaymentRequest) GetPaymentRequest() string {
if m != nil { if m != nil {
return m.PaymentRequest return m.PaymentRequest
} }
return "" return ""
} }
func (m *PaymentRequest) GetTimeoutSeconds() int32 { func (m *SendPaymentRequest) GetTimeoutSeconds() int32 {
if m != nil { if m != nil {
return m.TimeoutSeconds return m.TimeoutSeconds
} }
return 0 return 0
} }
func (m *PaymentRequest) GetFeeLimitSat() int64 { func (m *SendPaymentRequest) GetFeeLimitSat() int64 {
if m != nil { if m != nil {
return m.FeeLimitSat return m.FeeLimitSat
} }
return 0 return 0
} }
func (m *PaymentRequest) GetOutgoingChanId() uint64 { func (m *SendPaymentRequest) GetOutgoingChanId() uint64 {
if m != nil { if m != nil {
return m.OutgoingChanId return m.OutgoingChanId
} }
return 0 return 0
} }
func (m *PaymentRequest) GetCltvLimit() int32 { func (m *SendPaymentRequest) GetCltvLimit() int32 {
if m != nil { if m != nil {
return m.CltvLimit return m.CltvLimit
} }
return 0 return 0
} }
type PaymentResponse struct { type TrackPaymentRequest struct {
//* /// The hash of the payment to look up.
//The payment hash that we paid to. Provided so callers are able to map PaymentHash []byte `protobuf:"bytes,1,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
//responses (which may be streaming) back to their original requests.
PayHash []byte `protobuf:"bytes,1,opt,name=pay_hash,json=payHash,proto3" json:"pay_hash,omitempty"`
//*
//The pre-image of the payment successfully completed.
PreImage []byte `protobuf:"bytes,2,opt,name=pre_image,json=preImage,proto3" json:"pre_image,omitempty"`
//*
//If not an empty string, then a string representation of the payment error.
PaymentErr string `protobuf:"bytes,3,opt,name=payment_err,json=paymentErr,proto3" json:"payment_err,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *PaymentResponse) Reset() { *m = PaymentResponse{} } func (m *TrackPaymentRequest) Reset() { *m = TrackPaymentRequest{} }
func (m *PaymentResponse) String() string { return proto.CompactTextString(m) } func (m *TrackPaymentRequest) String() string { return proto.CompactTextString(m) }
func (*PaymentResponse) ProtoMessage() {} func (*TrackPaymentRequest) ProtoMessage() {}
func (*PaymentResponse) Descriptor() ([]byte, []int) { func (*TrackPaymentRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{1} return fileDescriptor_7a0613f69d37b0a5, []int{1}
} }
func (m *PaymentResponse) XXX_Unmarshal(b []byte) error { func (m *TrackPaymentRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PaymentResponse.Unmarshal(m, b) return xxx_messageInfo_TrackPaymentRequest.Unmarshal(m, b)
} }
func (m *PaymentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TrackPaymentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PaymentResponse.Marshal(b, m, deterministic) return xxx_messageInfo_TrackPaymentRequest.Marshal(b, m, deterministic)
} }
func (m *PaymentResponse) XXX_Merge(src proto.Message) { func (m *TrackPaymentRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_PaymentResponse.Merge(m, src) xxx_messageInfo_TrackPaymentRequest.Merge(m, src)
} }
func (m *PaymentResponse) XXX_Size() int { func (m *TrackPaymentRequest) XXX_Size() int {
return xxx_messageInfo_PaymentResponse.Size(m) return xxx_messageInfo_TrackPaymentRequest.Size(m)
} }
func (m *PaymentResponse) XXX_DiscardUnknown() { func (m *TrackPaymentRequest) XXX_DiscardUnknown() {
xxx_messageInfo_PaymentResponse.DiscardUnknown(m) xxx_messageInfo_TrackPaymentRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_PaymentResponse proto.InternalMessageInfo var xxx_messageInfo_TrackPaymentRequest proto.InternalMessageInfo
func (m *PaymentResponse) GetPayHash() []byte { func (m *TrackPaymentRequest) GetPaymentHash() []byte {
if m != nil { if m != nil {
return m.PayHash return m.PaymentHash
} }
return nil return nil
} }
func (m *PaymentResponse) GetPreImage() []byte { type PaymentStatus struct {
/// Current state the payment is in.
State PaymentState `protobuf:"varint,1,opt,name=state,proto3,enum=routerrpc.PaymentState" json:"state,omitempty"`
//*
//The pre-image of the payment when state is SUCCEEDED.
Preimage []byte `protobuf:"bytes,2,opt,name=preimage,proto3" json:"preimage,omitempty"`
//*
//The taken route when state is SUCCEEDED.
Route *lnrpc.Route `protobuf:"bytes,3,opt,name=route,proto3" json:"route,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PaymentStatus) Reset() { *m = PaymentStatus{} }
func (m *PaymentStatus) String() string { return proto.CompactTextString(m) }
func (*PaymentStatus) ProtoMessage() {}
func (*PaymentStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{2}
}
func (m *PaymentStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PaymentStatus.Unmarshal(m, b)
}
func (m *PaymentStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PaymentStatus.Marshal(b, m, deterministic)
}
func (m *PaymentStatus) XXX_Merge(src proto.Message) {
xxx_messageInfo_PaymentStatus.Merge(m, src)
}
func (m *PaymentStatus) XXX_Size() int {
return xxx_messageInfo_PaymentStatus.Size(m)
}
func (m *PaymentStatus) XXX_DiscardUnknown() {
xxx_messageInfo_PaymentStatus.DiscardUnknown(m)
}
var xxx_messageInfo_PaymentStatus proto.InternalMessageInfo
func (m *PaymentStatus) GetState() PaymentState {
if m != nil { if m != nil {
return m.PreImage return m.State
}
return PaymentState_IN_FLIGHT
}
func (m *PaymentStatus) GetPreimage() []byte {
if m != nil {
return m.Preimage
} }
return nil return nil
} }
func (m *PaymentResponse) GetPaymentErr() string { func (m *PaymentStatus) GetRoute() *lnrpc.Route {
if m != nil { if m != nil {
return m.PaymentErr return m.Route
} }
return "" return nil
} }
type RouteFeeRequest struct { type RouteFeeRequest struct {
@ -321,7 +399,7 @@ func (m *RouteFeeRequest) Reset() { *m = RouteFeeRequest{} }
func (m *RouteFeeRequest) String() string { return proto.CompactTextString(m) } func (m *RouteFeeRequest) String() string { return proto.CompactTextString(m) }
func (*RouteFeeRequest) ProtoMessage() {} func (*RouteFeeRequest) ProtoMessage() {}
func (*RouteFeeRequest) Descriptor() ([]byte, []int) { func (*RouteFeeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{2} return fileDescriptor_7a0613f69d37b0a5, []int{3}
} }
func (m *RouteFeeRequest) XXX_Unmarshal(b []byte) error { func (m *RouteFeeRequest) XXX_Unmarshal(b []byte) error {
@ -375,7 +453,7 @@ func (m *RouteFeeResponse) Reset() { *m = RouteFeeResponse{} }
func (m *RouteFeeResponse) String() string { return proto.CompactTextString(m) } func (m *RouteFeeResponse) String() string { return proto.CompactTextString(m) }
func (*RouteFeeResponse) ProtoMessage() {} func (*RouteFeeResponse) ProtoMessage() {}
func (*RouteFeeResponse) Descriptor() ([]byte, []int) { func (*RouteFeeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{3} return fileDescriptor_7a0613f69d37b0a5, []int{4}
} }
func (m *RouteFeeResponse) XXX_Unmarshal(b []byte) error { func (m *RouteFeeResponse) XXX_Unmarshal(b []byte) error {
@ -424,7 +502,7 @@ func (m *SendToRouteRequest) Reset() { *m = SendToRouteRequest{} }
func (m *SendToRouteRequest) String() string { return proto.CompactTextString(m) } func (m *SendToRouteRequest) String() string { return proto.CompactTextString(m) }
func (*SendToRouteRequest) ProtoMessage() {} func (*SendToRouteRequest) ProtoMessage() {}
func (*SendToRouteRequest) Descriptor() ([]byte, []int) { func (*SendToRouteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{4} return fileDescriptor_7a0613f69d37b0a5, []int{5}
} }
func (m *SendToRouteRequest) XXX_Unmarshal(b []byte) error { func (m *SendToRouteRequest) XXX_Unmarshal(b []byte) error {
@ -473,7 +551,7 @@ func (m *SendToRouteResponse) Reset() { *m = SendToRouteResponse{} }
func (m *SendToRouteResponse) String() string { return proto.CompactTextString(m) } func (m *SendToRouteResponse) String() string { return proto.CompactTextString(m) }
func (*SendToRouteResponse) ProtoMessage() {} func (*SendToRouteResponse) ProtoMessage() {}
func (*SendToRouteResponse) Descriptor() ([]byte, []int) { func (*SendToRouteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{5} return fileDescriptor_7a0613f69d37b0a5, []int{6}
} }
func (m *SendToRouteResponse) XXX_Unmarshal(b []byte) error { func (m *SendToRouteResponse) XXX_Unmarshal(b []byte) error {
@ -534,7 +612,7 @@ func (m *Failure) Reset() { *m = Failure{} }
func (m *Failure) String() string { return proto.CompactTextString(m) } func (m *Failure) String() string { return proto.CompactTextString(m) }
func (*Failure) ProtoMessage() {} func (*Failure) ProtoMessage() {}
func (*Failure) Descriptor() ([]byte, []int) { func (*Failure) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{6} return fileDescriptor_7a0613f69d37b0a5, []int{7}
} }
func (m *Failure) XXX_Unmarshal(b []byte) error { func (m *Failure) XXX_Unmarshal(b []byte) error {
@ -671,7 +749,7 @@ func (m *ChannelUpdate) Reset() { *m = ChannelUpdate{} }
func (m *ChannelUpdate) String() string { return proto.CompactTextString(m) } func (m *ChannelUpdate) String() string { return proto.CompactTextString(m) }
func (*ChannelUpdate) ProtoMessage() {} func (*ChannelUpdate) ProtoMessage() {}
func (*ChannelUpdate) Descriptor() ([]byte, []int) { func (*ChannelUpdate) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{7} return fileDescriptor_7a0613f69d37b0a5, []int{8}
} }
func (m *ChannelUpdate) XXX_Unmarshal(b []byte) error { func (m *ChannelUpdate) XXX_Unmarshal(b []byte) error {
@ -786,7 +864,7 @@ func (m *ResetMissionControlRequest) Reset() { *m = ResetMissionControlR
func (m *ResetMissionControlRequest) String() string { return proto.CompactTextString(m) } func (m *ResetMissionControlRequest) String() string { return proto.CompactTextString(m) }
func (*ResetMissionControlRequest) ProtoMessage() {} func (*ResetMissionControlRequest) ProtoMessage() {}
func (*ResetMissionControlRequest) Descriptor() ([]byte, []int) { func (*ResetMissionControlRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{8} return fileDescriptor_7a0613f69d37b0a5, []int{9}
} }
func (m *ResetMissionControlRequest) XXX_Unmarshal(b []byte) error { func (m *ResetMissionControlRequest) XXX_Unmarshal(b []byte) error {
@ -817,7 +895,7 @@ func (m *ResetMissionControlResponse) Reset() { *m = ResetMissionControl
func (m *ResetMissionControlResponse) String() string { return proto.CompactTextString(m) } func (m *ResetMissionControlResponse) String() string { return proto.CompactTextString(m) }
func (*ResetMissionControlResponse) ProtoMessage() {} func (*ResetMissionControlResponse) ProtoMessage() {}
func (*ResetMissionControlResponse) Descriptor() ([]byte, []int) { func (*ResetMissionControlResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{9} return fileDescriptor_7a0613f69d37b0a5, []int{10}
} }
func (m *ResetMissionControlResponse) XXX_Unmarshal(b []byte) error { func (m *ResetMissionControlResponse) XXX_Unmarshal(b []byte) error {
@ -848,7 +926,7 @@ func (m *QueryMissionControlRequest) Reset() { *m = QueryMissionControlR
func (m *QueryMissionControlRequest) String() string { return proto.CompactTextString(m) } func (m *QueryMissionControlRequest) String() string { return proto.CompactTextString(m) }
func (*QueryMissionControlRequest) ProtoMessage() {} func (*QueryMissionControlRequest) ProtoMessage() {}
func (*QueryMissionControlRequest) Descriptor() ([]byte, []int) { func (*QueryMissionControlRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{10} return fileDescriptor_7a0613f69d37b0a5, []int{11}
} }
func (m *QueryMissionControlRequest) XXX_Unmarshal(b []byte) error { func (m *QueryMissionControlRequest) XXX_Unmarshal(b []byte) error {
@ -881,7 +959,7 @@ func (m *QueryMissionControlResponse) Reset() { *m = QueryMissionControl
func (m *QueryMissionControlResponse) String() string { return proto.CompactTextString(m) } func (m *QueryMissionControlResponse) String() string { return proto.CompactTextString(m) }
func (*QueryMissionControlResponse) ProtoMessage() {} func (*QueryMissionControlResponse) ProtoMessage() {}
func (*QueryMissionControlResponse) Descriptor() ([]byte, []int) { func (*QueryMissionControlResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{11} return fileDescriptor_7a0613f69d37b0a5, []int{12}
} }
func (m *QueryMissionControlResponse) XXX_Unmarshal(b []byte) error { func (m *QueryMissionControlResponse) XXX_Unmarshal(b []byte) error {
@ -928,7 +1006,7 @@ func (m *NodeHistory) Reset() { *m = NodeHistory{} }
func (m *NodeHistory) String() string { return proto.CompactTextString(m) } func (m *NodeHistory) String() string { return proto.CompactTextString(m) }
func (*NodeHistory) ProtoMessage() {} func (*NodeHistory) ProtoMessage() {}
func (*NodeHistory) Descriptor() ([]byte, []int) { func (*NodeHistory) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{12} return fileDescriptor_7a0613f69d37b0a5, []int{13}
} }
func (m *NodeHistory) XXX_Unmarshal(b []byte) error { func (m *NodeHistory) XXX_Unmarshal(b []byte) error {
@ -996,7 +1074,7 @@ func (m *ChannelHistory) Reset() { *m = ChannelHistory{} }
func (m *ChannelHistory) String() string { return proto.CompactTextString(m) } func (m *ChannelHistory) String() string { return proto.CompactTextString(m) }
func (*ChannelHistory) ProtoMessage() {} func (*ChannelHistory) ProtoMessage() {}
func (*ChannelHistory) Descriptor() ([]byte, []int) { func (*ChannelHistory) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{13} return fileDescriptor_7a0613f69d37b0a5, []int{14}
} }
func (m *ChannelHistory) XXX_Unmarshal(b []byte) error { func (m *ChannelHistory) XXX_Unmarshal(b []byte) error {
@ -1046,9 +1124,11 @@ func (m *ChannelHistory) GetSuccessProb() float32 {
} }
func init() { func init() {
proto.RegisterEnum("routerrpc.PaymentState", PaymentState_name, PaymentState_value)
proto.RegisterEnum("routerrpc.Failure_FailureCode", Failure_FailureCode_name, Failure_FailureCode_value) proto.RegisterEnum("routerrpc.Failure_FailureCode", Failure_FailureCode_name, Failure_FailureCode_value)
proto.RegisterType((*PaymentRequest)(nil), "routerrpc.PaymentRequest") proto.RegisterType((*SendPaymentRequest)(nil), "routerrpc.SendPaymentRequest")
proto.RegisterType((*PaymentResponse)(nil), "routerrpc.PaymentResponse") proto.RegisterType((*TrackPaymentRequest)(nil), "routerrpc.TrackPaymentRequest")
proto.RegisterType((*PaymentStatus)(nil), "routerrpc.PaymentStatus")
proto.RegisterType((*RouteFeeRequest)(nil), "routerrpc.RouteFeeRequest") proto.RegisterType((*RouteFeeRequest)(nil), "routerrpc.RouteFeeRequest")
proto.RegisterType((*RouteFeeResponse)(nil), "routerrpc.RouteFeeResponse") proto.RegisterType((*RouteFeeResponse)(nil), "routerrpc.RouteFeeResponse")
proto.RegisterType((*SendToRouteRequest)(nil), "routerrpc.SendToRouteRequest") proto.RegisterType((*SendToRouteRequest)(nil), "routerrpc.SendToRouteRequest")
@ -1066,101 +1146,106 @@ 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{
// 1503 bytes of a gzipped FileDescriptorProto // 1575 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0xda, 0xce, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0x22, 0xc7,
0x15, 0x2f, 0x06, 0x1b, 0x38, 0x7c, 0xc9, 0xeb, 0x8f, 0x60, 0x6c, 0xe7, 0xef, 0xa8, 0x6d, 0xc2, 0x15, 0x36, 0x02, 0x09, 0x71, 0xf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0x65,
0x65, 0x4b, 0xe7, 0xae, 0x59, 0x79, 0xba, 0xef, 0xd7, 0xac, 0x7c, 0x62, 0x00, 0xbc, 0xfb, 0xed,
0x9f, 0xae, 0x46, 0xbe, 0x1c, 0xcf, 0x6f, 0x2f, 0x07, 0xe1, 0xf4, 0x6a, 0xe2, 0x8f, 0xc6, 0x32,
0xf0, 0x83, 0x51, 0xc0, 0xe5, 0x5f, 0xc2, 0xe8, 0xfe, 0x6a, 0x12, 0x0c, 0xaf, 0xf4, 0x32, 0x79,
0xb5, 0x54, 0x77, 0xbb, 0xa7, 0xff, 0xad, 0xfa, 0xdd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a,
0xf3, 0x15, 0x70, 0x86, 0x0d, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -1177,11 +1262,13 @@ const _ = grpc.SupportPackageIsVersion4
type RouterClient interface { type RouterClient interface {
//* //*
//SendPayment attempts to route a payment described by the passed //SendPayment attempts to route a payment described by the passed
//PaymentRequest to the final destination. If we are unable to route the //PaymentRequest to the final destination. The call returns a stream of
//payment, or cannot find a route that satisfies the constraints in the //payment status updates.
//PaymentRequest, then an error will be returned. Otherwise, the payment SendPayment(ctx context.Context, in *SendPaymentRequest, opts ...grpc.CallOption) (Router_SendPaymentClient, error)
//pre-image, along with the final route will be returned. //*
SendPayment(ctx context.Context, in *PaymentRequest, opts ...grpc.CallOption) (*PaymentResponse, error) //TrackPayment returns an update stream for the payment identified by the
//payment hash.
TrackPayment(ctx context.Context, in *TrackPaymentRequest, opts ...grpc.CallOption) (Router_TrackPaymentClient, error)
//* //*
//EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it //EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
//may cost to send an HTLC to the target end destination. //may cost to send an HTLC to the target end destination.
@ -1209,13 +1296,68 @@ func NewRouterClient(cc *grpc.ClientConn) RouterClient {
return &routerClient{cc} return &routerClient{cc}
} }
func (c *routerClient) SendPayment(ctx context.Context, in *PaymentRequest, opts ...grpc.CallOption) (*PaymentResponse, error) { func (c *routerClient) SendPayment(ctx context.Context, in *SendPaymentRequest, opts ...grpc.CallOption) (Router_SendPaymentClient, error) {
out := new(PaymentResponse) stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[0], "/routerrpc.Router/SendPayment", opts...)
err := c.cc.Invoke(ctx, "/routerrpc.Router/SendPayment", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return out, nil x := &routerSendPaymentClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Router_SendPaymentClient interface {
Recv() (*PaymentStatus, error)
grpc.ClientStream
}
type routerSendPaymentClient struct {
grpc.ClientStream
}
func (x *routerSendPaymentClient) Recv() (*PaymentStatus, error) {
m := new(PaymentStatus)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *routerClient) TrackPayment(ctx context.Context, in *TrackPaymentRequest, opts ...grpc.CallOption) (Router_TrackPaymentClient, error) {
stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[1], "/routerrpc.Router/TrackPayment", opts...)
if err != nil {
return nil, err
}
x := &routerTrackPaymentClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Router_TrackPaymentClient interface {
Recv() (*PaymentStatus, error)
grpc.ClientStream
}
type routerTrackPaymentClient struct {
grpc.ClientStream
}
func (x *routerTrackPaymentClient) Recv() (*PaymentStatus, error) {
m := new(PaymentStatus)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
} }
func (c *routerClient) EstimateRouteFee(ctx context.Context, in *RouteFeeRequest, opts ...grpc.CallOption) (*RouteFeeResponse, error) { func (c *routerClient) EstimateRouteFee(ctx context.Context, in *RouteFeeRequest, opts ...grpc.CallOption) (*RouteFeeResponse, error) {
@ -1258,11 +1400,13 @@ func (c *routerClient) QueryMissionControl(ctx context.Context, in *QueryMission
type RouterServer interface { type RouterServer interface {
//* //*
//SendPayment attempts to route a payment described by the passed //SendPayment attempts to route a payment described by the passed
//PaymentRequest to the final destination. If we are unable to route the //PaymentRequest to the final destination. The call returns a stream of
//payment, or cannot find a route that satisfies the constraints in the //payment status updates.
//PaymentRequest, then an error will be returned. Otherwise, the payment SendPayment(*SendPaymentRequest, Router_SendPaymentServer) error
//pre-image, along with the final route will be returned. //*
SendPayment(context.Context, *PaymentRequest) (*PaymentResponse, error) //TrackPayment returns an update stream for the payment identified by the
//payment hash.
TrackPayment(*TrackPaymentRequest, Router_TrackPaymentServer) error
//* //*
//EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it //EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
//may cost to send an HTLC to the target end destination. //may cost to send an HTLC to the target end destination.
@ -1286,22 +1430,46 @@ func RegisterRouterServer(s *grpc.Server, srv RouterServer) {
s.RegisterService(&_Router_serviceDesc, srv) s.RegisterService(&_Router_serviceDesc, srv)
} }
func _Router_SendPayment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Router_SendPayment_Handler(srv interface{}, stream grpc.ServerStream) error {
in := new(PaymentRequest) m := new(SendPaymentRequest)
if err := dec(in); err != nil { if err := stream.RecvMsg(m); err != nil {
return nil, err return err
} }
if interceptor == nil { return srv.(RouterServer).SendPayment(m, &routerSendPaymentServer{stream})
return srv.(RouterServer).SendPayment(ctx, in) }
type Router_SendPaymentServer interface {
Send(*PaymentStatus) error
grpc.ServerStream
}
type routerSendPaymentServer struct {
grpc.ServerStream
}
func (x *routerSendPaymentServer) Send(m *PaymentStatus) error {
return x.ServerStream.SendMsg(m)
}
func _Router_TrackPayment_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(TrackPaymentRequest)
if err := stream.RecvMsg(m); err != nil {
return err
} }
info := &grpc.UnaryServerInfo{ return srv.(RouterServer).TrackPayment(m, &routerTrackPaymentServer{stream})
Server: srv, }
FullMethod: "/routerrpc.Router/SendPayment",
} type Router_TrackPaymentServer interface {
handler := func(ctx context.Context, req interface{}) (interface{}, error) { Send(*PaymentStatus) error
return srv.(RouterServer).SendPayment(ctx, req.(*PaymentRequest)) grpc.ServerStream
} }
return interceptor(ctx, in, info, handler)
type routerTrackPaymentServer struct {
grpc.ServerStream
}
func (x *routerTrackPaymentServer) Send(m *PaymentStatus) error {
return x.ServerStream.SendMsg(m)
} }
func _Router_EstimateRouteFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Router_EstimateRouteFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@ -1380,10 +1548,6 @@ var _Router_serviceDesc = grpc.ServiceDesc{
ServiceName: "routerrpc.Router", ServiceName: "routerrpc.Router",
HandlerType: (*RouterServer)(nil), HandlerType: (*RouterServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "SendPayment",
Handler: _Router_SendPayment_Handler,
},
{ {
MethodName: "EstimateRouteFee", MethodName: "EstimateRouteFee",
Handler: _Router_EstimateRouteFee_Handler, Handler: _Router_EstimateRouteFee_Handler,
@ -1401,6 +1565,17 @@ var _Router_serviceDesc = grpc.ServiceDesc{
Handler: _Router_QueryMissionControl_Handler, Handler: _Router_QueryMissionControl_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{
{
StreamName: "SendPayment",
Handler: _Router_SendPayment_Handler,
ServerStreams: true,
},
{
StreamName: "TrackPayment",
Handler: _Router_TrackPayment_Handler,
ServerStreams: true,
},
},
Metadata: "routerrpc/router.proto", Metadata: "routerrpc/router.proto",
} }

@ -6,7 +6,7 @@ package routerrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc"; option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
message PaymentRequest { message SendPaymentRequest {
/// The identity pubkey of the payment recipient /// The identity pubkey of the payment recipient
bytes dest = 1; bytes dest = 1;
@ -60,24 +60,51 @@ message PaymentRequest {
int32 cltv_limit = 9; int32 cltv_limit = 9;
} }
message PaymentResponse { message TrackPaymentRequest {
/** /// The hash of the payment to look up.
The payment hash that we paid to. Provided so callers are able to map bytes payment_hash = 1;
responses (which may be streaming) back to their original requests.
*/
bytes pay_hash = 1;
/**
The pre-image of the payment successfully completed.
*/
bytes pre_image = 2;
/**
If not an empty string, then a string representation of the payment error.
*/
string payment_err = 3;
} }
enum PaymentState {
/**
Payment is still in flight.
*/
IN_FLIGHT = 0;
/**
Payment completed successfully.
*/
SUCCEEDED = 1;
/**
There are more routes to try, but the payment timeout was exceeded.
*/
FAILED_TIMEOUT = 2;
/**
All possible routes were tried and failed permanently. Or were no
routes to the destination at all.
*/
FAILED_NO_ROUTE = 3;
}
message PaymentStatus {
/// Current state the payment is in.
PaymentState state = 1;
/**
The pre-image of the payment when state is SUCCEEDED.
*/
bytes preimage = 2;
/**
The taken route when state is SUCCEEDED.
*/
lnrpc.Route route = 3;
}
message RouteFeeRequest { message RouteFeeRequest {
/** /**
The destination once wishes to obtain a routing fee quote to. The destination once wishes to obtain a routing fee quote to.
@ -305,12 +332,17 @@ message ChannelHistory {
service Router { service Router {
/** /**
SendPayment attempts to route a payment described by the passed SendPayment attempts to route a payment described by the passed
PaymentRequest to the final destination. If we are unable to route the PaymentRequest to the final destination. The call returns a stream of
payment, or cannot find a route that satisfies the constraints in the payment status updates.
PaymentRequest, then an error will be returned. Otherwise, the payment
pre-image, along with the final route will be returned.
*/ */
rpc SendPayment(PaymentRequest) returns (PaymentResponse); rpc SendPayment(SendPaymentRequest) returns (stream PaymentStatus);
/**
TrackPayment returns an update stream for the payment identified by the
payment hash.
*/
rpc TrackPayment(TrackPaymentRequest) returns (stream PaymentStatus);
/** /**
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it

@ -47,6 +47,10 @@ type RouterBackend struct {
// that we receive payment requests that send to destinations on our // that we receive payment requests that send to destinations on our
// network. // network.
ActiveNetParams *chaincfg.Params ActiveNetParams *chaincfg.Params
// Tower is the ControlTower instance that is used to track pending
// payments.
Tower routing.ControlTower
} }
// QueryRoutes attempts to query the daemons' Channel Router for a possible // QueryRoutes attempts to query the daemons' Channel Router for a possible
@ -349,8 +353,8 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
// extractIntentFromSendRequest attempts to parse the SendRequest details // extractIntentFromSendRequest attempts to parse the SendRequest details
// required to dispatch a client from the information presented by an RPC // required to dispatch a client from the information presented by an RPC
// client. // client.
func (r *RouterBackend) extractIntentFromSendRequest(rpcPayReq *PaymentRequest) ( func (r *RouterBackend) extractIntentFromSendRequest(
*routing.LightningPayment, error) { rpcPayReq *SendPaymentRequest) (*routing.LightningPayment, error) {
payIntent := &routing.LightningPayment{} payIntent := &routing.LightningPayment{}

@ -10,15 +10,18 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/routing/route"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gopkg.in/macaroon-bakery.v2/bakery" "gopkg.in/macaroon-bakery.v2/bakery"
) )
@ -53,6 +56,10 @@ var (
Entity: "offchain", Entity: "offchain",
Action: "write", Action: "write",
}}, }},
"/routerrpc.Router/TrackPayment": {{
Entity: "offchain",
Action: "read",
}},
"/routerrpc.Router/EstimateRouteFee": {{ "/routerrpc.Router/EstimateRouteFee": {{
Entity: "offchain", Entity: "offchain",
Action: "read", Action: "read",
@ -185,23 +192,35 @@ func (s *Server) RegisterWithRootServer(grpcServer *grpc.Server) error {
// payment, or cannot find a route that satisfies the constraints in the // payment, or cannot find a route that satisfies the constraints in the
// PaymentRequest, then an error will be returned. Otherwise, the payment // PaymentRequest, then an error will be returned. Otherwise, the payment
// pre-image, along with the final route will be returned. // pre-image, along with the final route will be returned.
func (s *Server) SendPayment(ctx context.Context, func (s *Server) SendPayment(req *SendPaymentRequest,
req *PaymentRequest) (*PaymentResponse, error) { stream Router_SendPaymentServer) error {
payment, err := s.cfg.RouterBackend.extractIntentFromSendRequest(req) payment, err := s.cfg.RouterBackend.extractIntentFromSendRequest(req)
if err != nil { if err != nil {
return nil, err return err
} }
preImage, _, err := s.cfg.Router.SendPayment(payment) err = s.cfg.Router.SendPaymentAsync(payment)
if err != nil { if err != nil {
return nil, err // Transform user errors to grpc code.
if err == channeldb.ErrPaymentInFlight ||
err == channeldb.ErrAlreadyPaid {
log.Debugf("SendPayment async result for hash %x: %v",
payment.PaymentHash, err)
return status.Error(
codes.AlreadyExists, err.Error(),
)
}
log.Errorf("SendPayment async error for hash %x: %v",
payment.PaymentHash, err)
return err
} }
return &PaymentResponse{ return s.trackPayment(payment.PaymentHash, stream)
PayHash: payment.PaymentHash[:],
PreImage: preImage[:],
}, nil
} }
// EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it // EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
@ -460,3 +479,89 @@ func (s *Server) QueryMissionControl(ctx context.Context,
return &response, nil return &response, nil
} }
// TrackPayment returns a stream of payment state updates. The stream is
// closed when the payment completes.
func (s *Server) TrackPayment(request *TrackPaymentRequest,
stream Router_TrackPaymentServer) error {
paymentHash, err := lntypes.MakeHash(request.PaymentHash)
if err != nil {
return err
}
log.Debugf("TrackPayment called for payment %v", paymentHash)
return s.trackPayment(paymentHash, stream)
}
// trackPayment writes payment status updates to the provided stream.
func (s *Server) trackPayment(paymentHash lntypes.Hash,
stream Router_TrackPaymentServer) error {
// Subscribe to the outcome of this payment.
inFlight, resultChan, err := s.cfg.RouterBackend.Tower.SubscribePayment(
paymentHash,
)
switch {
case err == channeldb.ErrPaymentNotInitiated:
return status.Error(codes.NotFound, err.Error())
case err != nil:
return err
}
// If it is in flight, send a state update to the client. Payment status
// update streams are expected to always send the current payment state
// immediately.
if inFlight {
err = stream.Send(&PaymentStatus{
State: PaymentState_IN_FLIGHT,
})
if err != nil {
return err
}
}
// Wait for the outcome of the payment. For payments that have
// completed, the result should already be waiting on the channel.
select {
case result := <-resultChan:
// Marshall result to rpc type.
var status PaymentStatus
if result.Success {
log.Debugf("Payment %v successfully completed",
paymentHash)
status.State = PaymentState_SUCCEEDED
status.Preimage = result.Preimage[:]
status.Route = s.cfg.RouterBackend.MarshallRoute(
result.Route,
)
} else {
switch result.FailureReason {
case channeldb.FailureReasonTimeout:
status.State = PaymentState_FAILED_TIMEOUT
case channeldb.FailureReasonNoRoute:
status.State = PaymentState_FAILED_NO_ROUTE
default:
return errors.New("unknown failure reason")
}
}
// Send event to the client.
err = stream.Send(&status)
if err != nil {
return err
}
case <-stream.Context().Done():
log.Debugf("Payment status stream %v canceled", paymentHash)
return stream.Context().Err()
}
return nil
}

@ -477,6 +477,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
FindRoute: s.chanRouter.FindRoute, FindRoute: s.chanRouter.FindRoute,
MissionControl: s.missionControl, MissionControl: s.missionControl,
ActiveNetParams: activeNetParams.Params, ActiveNetParams: activeNetParams.Params,
Tower: s.controlTower,
} }
var ( var (

@ -192,6 +192,8 @@ type server struct {
chanRouter *routing.ChannelRouter chanRouter *routing.ChannelRouter
controlTower routing.ControlTower
authGossiper *discovery.AuthenticatedGossiper authGossiper *discovery.AuthenticatedGossiper
utxoNursery *utxoNursery utxoNursery *utxoNursery
@ -651,12 +653,14 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
paymentControl := channeldb.NewPaymentControl(chanDB) paymentControl := channeldb.NewPaymentControl(chanDB)
s.controlTower = routing.NewControlTower(paymentControl)
s.chanRouter, err = routing.New(routing.Config{ s.chanRouter, err = routing.New(routing.Config{
Graph: chanGraph, Graph: chanGraph,
Chain: cc.chainIO, Chain: cc.chainIO,
ChainView: cc.chainView, ChainView: cc.chainView,
Payer: s.htlcSwitch, Payer: s.htlcSwitch,
Control: routing.NewControlTower(paymentControl), Control: s.controlTower,
MissionControl: s.missionControl, MissionControl: s.missionControl,
ChannelPruneExpiry: routing.DefaultChannelPruneExpiry, ChannelPruneExpiry: routing.DefaultChannelPruneExpiry,
GraphPruneInterval: time.Duration(time.Hour), GraphPruneInterval: time.Duration(time.Hour),