routing+routerrpc: notify full payment structures

This commit fixes the inconsistency between the payment state as
reported by routerrpc.SendPayment/routerrpc.TrackPayment and the main
rpc ListPayments call.

In addition to that, payment state changes are now sent out for every
state change. This opens the door to user interfaces giving more
feedback to the user about the payment process. This is especially
interesting for multi-part payments.
This commit is contained in:
Joost Jager 2020-04-03 17:05:05 +02:00
parent 5bebda8c5d
commit af4abe7d58
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
8 changed files with 392 additions and 617 deletions

@ -393,14 +393,14 @@ func sendPaymentRequest(ctx *cli.Context,
return err
}
if status.State != routerrpc.PaymentState_IN_FLIGHT {
if status.Status != lnrpc.Payment_IN_FLIGHT {
printRespJSON(status)
// If we get a payment error back, we pass an error up
// to main which eventually calls fatal() and returns
// with a non-zero exit code.
if status.State != routerrpc.PaymentState_SUCCEEDED {
return errors.New(status.State.String())
if status.Status != lnrpc.Payment_SUCCEEDED {
return errors.New(status.Status.String())
}
return nil
@ -454,7 +454,7 @@ func trackPayment(ctx *cli.Context) error {
printRespJSON(status)
if status.State != routerrpc.PaymentState_IN_FLIGHT {
if status.Status != lnrpc.Payment_IN_FLIGHT {
return nil
}
}

@ -23,62 +23,6 @@ var _ = math.Inf
// proto package needs to be updated.
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
//*
//A non-recoverable error has occured.
PaymentState_FAILED_ERROR PaymentState = 4
//*
//Payment details incorrect (unknown hash, invalid amt or
//invalid final cltv delta)
PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS PaymentState = 5
//*
//Insufficient local balance.
PaymentState_FAILED_INSUFFICIENT_BALANCE PaymentState = 6
)
var PaymentState_name = map[int32]string{
0: "IN_FLIGHT",
1: "SUCCEEDED",
2: "FAILED_TIMEOUT",
3: "FAILED_NO_ROUTE",
4: "FAILED_ERROR",
5: "FAILED_INCORRECT_PAYMENT_DETAILS",
6: "FAILED_INSUFFICIENT_BALANCE",
}
var PaymentState_value = map[string]int32{
"IN_FLIGHT": 0,
"SUCCEEDED": 1,
"FAILED_TIMEOUT": 2,
"FAILED_NO_ROUTE": 3,
"FAILED_ERROR": 4,
"FAILED_INCORRECT_PAYMENT_DETAILS": 5,
"FAILED_INSUFFICIENT_BALANCE": 6,
}
func (x PaymentState) String() string {
return proto.EnumName(PaymentState_name, int32(x))
}
func (PaymentState) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{0}
}
type FailureDetail int32
const (
@ -164,7 +108,7 @@ func (x FailureDetail) String() string {
}
func (FailureDetail) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{1}
return fileDescriptor_7a0613f69d37b0a5, []int{0}
}
type HtlcEvent_EventType int32
@ -195,7 +139,7 @@ func (x HtlcEvent_EventType) String() string {
}
func (HtlcEvent_EventType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{18, 0}
return fileDescriptor_7a0613f69d37b0a5, []int{17, 0}
}
type SendPaymentRequest struct {
@ -460,66 +404,6 @@ func (m *TrackPaymentRequest) GetPaymentHash() []byte {
return nil
}
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 HTLCs made in attempt to settle the payment.
Htlcs []*lnrpc.HTLCAttempt `protobuf:"bytes,4,rep,name=htlcs,proto3" json:"htlcs,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 {
return m.State
}
return PaymentState_IN_FLIGHT
}
func (m *PaymentStatus) GetPreimage() []byte {
if m != nil {
return m.Preimage
}
return nil
}
func (m *PaymentStatus) GetHtlcs() []*lnrpc.HTLCAttempt {
if m != nil {
return m.Htlcs
}
return nil
}
type RouteFeeRequest struct {
//*
//The destination once wishes to obtain a routing fee quote to.
@ -536,7 +420,7 @@ func (m *RouteFeeRequest) Reset() { *m = RouteFeeRequest{} }
func (m *RouteFeeRequest) String() string { return proto.CompactTextString(m) }
func (*RouteFeeRequest) ProtoMessage() {}
func (*RouteFeeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{3}
return fileDescriptor_7a0613f69d37b0a5, []int{2}
}
func (m *RouteFeeRequest) XXX_Unmarshal(b []byte) error {
@ -590,7 +474,7 @@ func (m *RouteFeeResponse) Reset() { *m = RouteFeeResponse{} }
func (m *RouteFeeResponse) String() string { return proto.CompactTextString(m) }
func (*RouteFeeResponse) ProtoMessage() {}
func (*RouteFeeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{4}
return fileDescriptor_7a0613f69d37b0a5, []int{3}
}
func (m *RouteFeeResponse) XXX_Unmarshal(b []byte) error {
@ -639,7 +523,7 @@ func (m *SendToRouteRequest) Reset() { *m = SendToRouteRequest{} }
func (m *SendToRouteRequest) String() string { return proto.CompactTextString(m) }
func (*SendToRouteRequest) ProtoMessage() {}
func (*SendToRouteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{5}
return fileDescriptor_7a0613f69d37b0a5, []int{4}
}
func (m *SendToRouteRequest) XXX_Unmarshal(b []byte) error {
@ -688,7 +572,7 @@ func (m *SendToRouteResponse) Reset() { *m = SendToRouteResponse{} }
func (m *SendToRouteResponse) String() string { return proto.CompactTextString(m) }
func (*SendToRouteResponse) ProtoMessage() {}
func (*SendToRouteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{6}
return fileDescriptor_7a0613f69d37b0a5, []int{5}
}
func (m *SendToRouteResponse) XXX_Unmarshal(b []byte) error {
@ -733,7 +617,7 @@ func (m *ResetMissionControlRequest) Reset() { *m = ResetMissionControlR
func (m *ResetMissionControlRequest) String() string { return proto.CompactTextString(m) }
func (*ResetMissionControlRequest) ProtoMessage() {}
func (*ResetMissionControlRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{7}
return fileDescriptor_7a0613f69d37b0a5, []int{6}
}
func (m *ResetMissionControlRequest) XXX_Unmarshal(b []byte) error {
@ -764,7 +648,7 @@ func (m *ResetMissionControlResponse) Reset() { *m = ResetMissionControl
func (m *ResetMissionControlResponse) String() string { return proto.CompactTextString(m) }
func (*ResetMissionControlResponse) ProtoMessage() {}
func (*ResetMissionControlResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{8}
return fileDescriptor_7a0613f69d37b0a5, []int{7}
}
func (m *ResetMissionControlResponse) XXX_Unmarshal(b []byte) error {
@ -795,7 +679,7 @@ func (m *QueryMissionControlRequest) Reset() { *m = QueryMissionControlR
func (m *QueryMissionControlRequest) String() string { return proto.CompactTextString(m) }
func (*QueryMissionControlRequest) ProtoMessage() {}
func (*QueryMissionControlRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{9}
return fileDescriptor_7a0613f69d37b0a5, []int{8}
}
func (m *QueryMissionControlRequest) XXX_Unmarshal(b []byte) error {
@ -829,7 +713,7 @@ func (m *QueryMissionControlResponse) Reset() { *m = QueryMissionControl
func (m *QueryMissionControlResponse) String() string { return proto.CompactTextString(m) }
func (*QueryMissionControlResponse) ProtoMessage() {}
func (*QueryMissionControlResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{10}
return fileDescriptor_7a0613f69d37b0a5, []int{9}
}
func (m *QueryMissionControlResponse) XXX_Unmarshal(b []byte) error {
@ -873,7 +757,7 @@ func (m *PairHistory) Reset() { *m = PairHistory{} }
func (m *PairHistory) String() string { return proto.CompactTextString(m) }
func (*PairHistory) ProtoMessage() {}
func (*PairHistory) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{11}
return fileDescriptor_7a0613f69d37b0a5, []int{10}
}
func (m *PairHistory) XXX_Unmarshal(b []byte) error {
@ -941,7 +825,7 @@ 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{12}
return fileDescriptor_7a0613f69d37b0a5, []int{11}
}
func (m *PairData) XXX_Unmarshal(b []byte) error {
@ -1020,7 +904,7 @@ 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{13}
return fileDescriptor_7a0613f69d37b0a5, []int{12}
}
func (m *QueryProbabilityRequest) XXX_Unmarshal(b []byte) error {
@ -1076,7 +960,7 @@ func (m *QueryProbabilityResponse) Reset() { *m = QueryProbabilityRespon
func (m *QueryProbabilityResponse) String() string { return proto.CompactTextString(m) }
func (*QueryProbabilityResponse) ProtoMessage() {}
func (*QueryProbabilityResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{14}
return fileDescriptor_7a0613f69d37b0a5, []int{13}
}
func (m *QueryProbabilityResponse) XXX_Unmarshal(b []byte) error {
@ -1137,7 +1021,7 @@ func (m *BuildRouteRequest) Reset() { *m = BuildRouteRequest{} }
func (m *BuildRouteRequest) String() string { return proto.CompactTextString(m) }
func (*BuildRouteRequest) ProtoMessage() {}
func (*BuildRouteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{15}
return fileDescriptor_7a0613f69d37b0a5, []int{14}
}
func (m *BuildRouteRequest) XXX_Unmarshal(b []byte) error {
@ -1199,7 +1083,7 @@ func (m *BuildRouteResponse) Reset() { *m = BuildRouteResponse{} }
func (m *BuildRouteResponse) String() string { return proto.CompactTextString(m) }
func (*BuildRouteResponse) ProtoMessage() {}
func (*BuildRouteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{16}
return fileDescriptor_7a0613f69d37b0a5, []int{15}
}
func (m *BuildRouteResponse) XXX_Unmarshal(b []byte) error {
@ -1237,7 +1121,7 @@ func (m *SubscribeHtlcEventsRequest) Reset() { *m = SubscribeHtlcEventsR
func (m *SubscribeHtlcEventsRequest) String() string { return proto.CompactTextString(m) }
func (*SubscribeHtlcEventsRequest) ProtoMessage() {}
func (*SubscribeHtlcEventsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{17}
return fileDescriptor_7a0613f69d37b0a5, []int{16}
}
func (m *SubscribeHtlcEventsRequest) XXX_Unmarshal(b []byte) error {
@ -1304,7 +1188,7 @@ func (m *HtlcEvent) Reset() { *m = HtlcEvent{} }
func (m *HtlcEvent) String() string { return proto.CompactTextString(m) }
func (*HtlcEvent) ProtoMessage() {}
func (*HtlcEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{18}
return fileDescriptor_7a0613f69d37b0a5, []int{17}
}
func (m *HtlcEvent) XXX_Unmarshal(b []byte) error {
@ -1458,7 +1342,7 @@ func (m *HtlcInfo) Reset() { *m = HtlcInfo{} }
func (m *HtlcInfo) String() string { return proto.CompactTextString(m) }
func (*HtlcInfo) ProtoMessage() {}
func (*HtlcInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{19}
return fileDescriptor_7a0613f69d37b0a5, []int{18}
}
func (m *HtlcInfo) XXX_Unmarshal(b []byte) error {
@ -1519,7 +1403,7 @@ func (m *ForwardEvent) Reset() { *m = ForwardEvent{} }
func (m *ForwardEvent) String() string { return proto.CompactTextString(m) }
func (*ForwardEvent) ProtoMessage() {}
func (*ForwardEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{20}
return fileDescriptor_7a0613f69d37b0a5, []int{19}
}
func (m *ForwardEvent) XXX_Unmarshal(b []byte) error {
@ -1557,7 +1441,7 @@ func (m *ForwardFailEvent) Reset() { *m = ForwardFailEvent{} }
func (m *ForwardFailEvent) String() string { return proto.CompactTextString(m) }
func (*ForwardFailEvent) ProtoMessage() {}
func (*ForwardFailEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{21}
return fileDescriptor_7a0613f69d37b0a5, []int{20}
}
func (m *ForwardFailEvent) XXX_Unmarshal(b []byte) error {
@ -1588,7 +1472,7 @@ func (m *SettleEvent) Reset() { *m = SettleEvent{} }
func (m *SettleEvent) String() string { return proto.CompactTextString(m) }
func (*SettleEvent) ProtoMessage() {}
func (*SettleEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{22}
return fileDescriptor_7a0613f69d37b0a5, []int{21}
}
func (m *SettleEvent) XXX_Unmarshal(b []byte) error {
@ -1630,7 +1514,7 @@ func (m *LinkFailEvent) Reset() { *m = LinkFailEvent{} }
func (m *LinkFailEvent) String() string { return proto.CompactTextString(m) }
func (*LinkFailEvent) ProtoMessage() {}
func (*LinkFailEvent) Descriptor() ([]byte, []int) {
return fileDescriptor_7a0613f69d37b0a5, []int{23}
return fileDescriptor_7a0613f69d37b0a5, []int{22}
}
func (m *LinkFailEvent) XXX_Unmarshal(b []byte) error {
@ -1680,13 +1564,11 @@ func (m *LinkFailEvent) GetFailureString() string {
}
func init() {
proto.RegisterEnum("routerrpc.PaymentState", PaymentState_name, PaymentState_value)
proto.RegisterEnum("routerrpc.FailureDetail", FailureDetail_name, FailureDetail_value)
proto.RegisterEnum("routerrpc.HtlcEvent_EventType", HtlcEvent_EventType_name, HtlcEvent_EventType_value)
proto.RegisterType((*SendPaymentRequest)(nil), "routerrpc.SendPaymentRequest")
proto.RegisterMapType((map[uint64][]byte)(nil), "routerrpc.SendPaymentRequest.DestCustomRecordsEntry")
proto.RegisterType((*TrackPaymentRequest)(nil), "routerrpc.TrackPaymentRequest")
proto.RegisterType((*PaymentStatus)(nil), "routerrpc.PaymentStatus")
proto.RegisterType((*RouteFeeRequest)(nil), "routerrpc.RouteFeeRequest")
proto.RegisterType((*RouteFeeResponse)(nil), "routerrpc.RouteFeeResponse")
proto.RegisterType((*SendToRouteRequest)(nil), "routerrpc.SendToRouteRequest")
@ -1713,142 +1595,134 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 2150 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 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77, 0xfd, 0xb5, 0x28, 0x9f,
0xba, 0xf4, 0xbf, 0x07, 0xed, 0xf6, 0xe5, 0x0e, 0xe9, 0xb7, 0xc7, 0xde, 0xbd, 0x65, 0x36, 0x7f,
0xf6, 0x49, 0x4e, 0xea, 0xdc, 0x02, 0x58, 0x5d, 0x91, 0xd0, 0xa3, 0xcc, 0x90, 0x3b, 0x57, 0xbc,
0xe6, 0xe3, 0x7b, 0xac, 0xa9, 0xab, 0x21, 0xd4, 0x37, 0xdc, 0x99, 0xd6, 0x66, 0xe3, 0xfe, 0x3b,
0x55, 0xf3, 0xc1, 0xa6, 0xab, 0xc5, 0x0b, 0xe5, 0xf8, 0xeb, 0x3f, 0x1f, 0x5e, 0x79, 0x6c, 0xba,
0xb8, 0x3c, 0x18, 0x85, 0xb3, 0x43, 0xdf, 0xbb, 0x9a, 0xb2, 0xc0, 0x0b, 0xae, 0x02, 0xca, 0x3e,
0x86, 0xd1, 0xf5, 0xa1, 0x1f, 0x8c, 0x0f, 0x85, 0x2e, 0x0f, 0x97, 0xc3, 0x2f, 0xb7, 0xc5, 0x6f,
0x47, 0xbf, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0xbe, 0x98, 0x4d, 0x6b, 0x12, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1866,7 +1740,7 @@ type RouterClient interface {
//*
//SendPayment attempts to route a payment described by the passed
//PaymentRequest to the final destination. The call returns a stream of
//payment status updates.
//payment updates.
SendPayment(ctx context.Context, in *SendPaymentRequest, opts ...grpc.CallOption) (Router_SendPaymentClient, error)
//*
//TrackPayment returns an update stream for the payment identified by the
@ -1928,7 +1802,7 @@ func (c *routerClient) SendPayment(ctx context.Context, in *SendPaymentRequest,
}
type Router_SendPaymentClient interface {
Recv() (*PaymentStatus, error)
Recv() (*lnrpc.Payment, error)
grpc.ClientStream
}
@ -1936,8 +1810,8 @@ type routerSendPaymentClient struct {
grpc.ClientStream
}
func (x *routerSendPaymentClient) Recv() (*PaymentStatus, error) {
m := new(PaymentStatus)
func (x *routerSendPaymentClient) Recv() (*lnrpc.Payment, error) {
m := new(lnrpc.Payment)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
@ -1960,7 +1834,7 @@ func (c *routerClient) TrackPayment(ctx context.Context, in *TrackPaymentRequest
}
type Router_TrackPaymentClient interface {
Recv() (*PaymentStatus, error)
Recv() (*lnrpc.Payment, error)
grpc.ClientStream
}
@ -1968,8 +1842,8 @@ type routerTrackPaymentClient struct {
grpc.ClientStream
}
func (x *routerTrackPaymentClient) Recv() (*PaymentStatus, error) {
m := new(PaymentStatus)
func (x *routerTrackPaymentClient) Recv() (*lnrpc.Payment, error) {
m := new(lnrpc.Payment)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
@ -2067,7 +1941,7 @@ type RouterServer interface {
//*
//SendPayment attempts to route a payment described by the passed
//PaymentRequest to the final destination. The call returns a stream of
//payment status updates.
//payment updates.
SendPayment(*SendPaymentRequest, Router_SendPaymentServer) error
//*
//TrackPayment returns an update stream for the payment identified by the
@ -2118,7 +1992,7 @@ func _Router_SendPayment_Handler(srv interface{}, stream grpc.ServerStream) erro
}
type Router_SendPaymentServer interface {
Send(*PaymentStatus) error
Send(*lnrpc.Payment) error
grpc.ServerStream
}
@ -2126,7 +2000,7 @@ type routerSendPaymentServer struct {
grpc.ServerStream
}
func (x *routerSendPaymentServer) Send(m *PaymentStatus) error {
func (x *routerSendPaymentServer) Send(m *lnrpc.Payment) error {
return x.ServerStream.SendMsg(m)
}
@ -2139,7 +2013,7 @@ func _Router_TrackPayment_Handler(srv interface{}, stream grpc.ServerStream) err
}
type Router_TrackPaymentServer interface {
Send(*PaymentStatus) error
Send(*lnrpc.Payment) error
grpc.ServerStream
}
@ -2147,7 +2021,7 @@ type routerTrackPaymentServer struct {
grpc.ServerStream
}
func (x *routerTrackPaymentServer) Send(m *PaymentStatus) error {
func (x *routerTrackPaymentServer) Send(m *lnrpc.Payment) error {
return x.ServerStream.SendMsg(m)
}

@ -121,62 +121,6 @@ message TrackPaymentRequest {
bytes payment_hash = 1;
}
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;
/**
A non-recoverable error has occured.
*/
FAILED_ERROR = 4;
/**
Payment details incorrect (unknown hash, invalid amt or
invalid final cltv delta)
*/
FAILED_INCORRECT_PAYMENT_DETAILS = 5;
/**
Insufficient local balance.
*/
FAILED_INSUFFICIENT_BALANCE = 6;
}
message PaymentStatus {
/// Current state the payment is in.
PaymentState state = 1;
/**
The pre-image of the payment when state is SUCCEEDED.
*/
bytes preimage = 2;
reserved 3;
/**
The HTLCs made in attempt to settle the payment.
*/
repeated lnrpc.HTLCAttempt htlcs = 4;
}
message RouteFeeRequest {
/**
The destination once wishes to obtain a routing fee quote to.
@ -465,15 +409,15 @@ service Router {
/**
SendPayment attempts to route a payment described by the passed
PaymentRequest to the final destination. The call returns a stream of
payment status updates.
payment updates.
*/
rpc SendPayment (SendPaymentRequest) returns (stream PaymentStatus);
rpc SendPayment (SendPaymentRequest) returns (stream lnrpc.Payment);
/**
TrackPayment returns an update stream for the payment identified by the
payment hash.
*/
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus);
rpc TrackPayment (TrackPaymentRequest) returns (stream lnrpc.Payment);
/**
EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it

@ -441,7 +441,7 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
router := s.cfg.RouterBackend
// Subscribe to the outcome of this payment.
inFlight, resultChan, err := router.Tower.SubscribePayment(
subscription, err := router.Tower.SubscribePayment(
paymentHash,
)
switch {
@ -450,95 +450,37 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
case err != nil:
return err
}
defer subscription.Close()
// 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[:]
} else {
state, err := marshallFailureReason(
result.FailureReason,
)
if err != nil {
return err
// Stream updates back to the client. The first update is always the
// current state of the payment.
for {
select {
case item, ok := <-subscription.Updates:
if !ok {
// No more payment updates.
return nil
}
status.State = state
}
// Marshal our list of HTLCs that have been tried for this
// payment.
htlcs := make([]*lnrpc.HTLCAttempt, 0, len(result.HTLCs))
for _, dbHtlc := range result.HTLCs {
htlc, err := router.MarshalHTLCAttempt(dbHtlc)
result := item.(*channeldb.MPPayment)
rpcPayment, err := router.MarshallPayment(result)
if err != nil {
return err
}
htlcs = append(htlcs, htlc)
// Send event to the client.
err = stream.Send(rpcPayment)
if err != nil {
return err
}
case <-s.quit:
return errServerShuttingDown
case <-stream.Context().Done():
log.Debugf("Payment status stream %v canceled", paymentHash)
return stream.Context().Err()
}
status.Htlcs = htlcs
// Send event to the client.
err = stream.Send(&status)
if err != nil {
return err
}
case <-s.quit:
return errServerShuttingDown
case <-stream.Context().Done():
log.Debugf("Payment status stream %v canceled", paymentHash)
return stream.Context().Err()
}
return nil
}
// marshallFailureReason marshalls the failure reason to the corresponding rpc
// type.
func marshallFailureReason(reason channeldb.FailureReason) (
PaymentState, error) {
switch reason {
case channeldb.FailureReasonTimeout:
return PaymentState_FAILED_TIMEOUT, nil
case channeldb.FailureReasonNoRoute:
return PaymentState_FAILED_NO_ROUTE, nil
case channeldb.FailureReasonError:
return PaymentState_FAILED_ERROR, nil
case channeldb.FailureReasonPaymentDetails:
return PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS, nil
case channeldb.FailureReasonInsufficientBalance:
return PaymentState_FAILED_INSUFFICIENT_BALANCE, nil
}
return 0, errors.New("unknown failure reason")
}
// BuildRoute builds a route from a list of hop addresses.

@ -14271,13 +14271,13 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
// Wait for inlight status update.
for _, payStream := range paymentStreams {
status, err := payStream.Recv()
payment, err := payStream.Recv()
if err != nil {
t.Fatalf("Failed receiving status update: %v", err)
}
if status.State != routerrpc.PaymentState_IN_FLIGHT {
t.Fatalf("state not in flight: %v", status.State)
if payment.Status != lnrpc.Payment_IN_FLIGHT {
t.Fatalf("state not in flight: %v", payment.Status)
}
}
@ -14355,7 +14355,7 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
// Now after a restart, we must re-track the payments. We set up a
// goroutine for each to track thir status updates.
var (
statusUpdates []chan *routerrpc.PaymentStatus
statusUpdates []chan *lnrpc.Payment
wg sync.WaitGroup
quit = make(chan struct{})
)
@ -14377,20 +14377,20 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
}
// We set up a channel where we'll forward any status update.
upd := make(chan *routerrpc.PaymentStatus)
upd := make(chan *lnrpc.Payment)
wg.Add(1)
go func() {
defer wg.Done()
for {
status, err := payStream.Recv()
payment, err := payStream.Recv()
if err != nil {
close(upd)
return
}
select {
case upd <- status:
case upd <- payment:
case <-quit:
return
}
@ -14400,17 +14400,17 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
statusUpdates = append(statusUpdates, upd)
}
// Wait for the infligt status update.
// Wait for the in-flight status update.
for _, upd := range statusUpdates {
select {
case status, ok := <-upd:
case payment, ok := <-upd:
if !ok {
t.Fatalf("failed getting status update")
t.Fatalf("failed getting payment update")
}
if status.State != routerrpc.PaymentState_IN_FLIGHT {
if payment.Status != lnrpc.Payment_IN_FLIGHT {
t.Fatalf("state not in in flight: %v",
status.State)
payment.Status)
}
case <-time.After(5 * time.Second):
t.Fatalf("in flight status not recevied")
@ -14439,25 +14439,38 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
// Make sure we get the expected status update.
for i, upd := range statusUpdates {
select {
case status, ok := <-upd:
if !ok {
t.Fatalf("failed getting status update")
}
// Read until the payment is in a terminal state.
var payment *lnrpc.Payment
for payment == nil {
select {
case p, ok := <-upd:
if !ok {
t.Fatalf("failed getting payment update")
}
if i%2 == 0 {
if status.State != routerrpc.PaymentState_SUCCEEDED {
t.Fatalf("state not suceeded : %v",
status.State)
}
} else {
if status.State != routerrpc.PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS {
t.Fatalf("state not failed: %v",
status.State)
if p.Status == lnrpc.Payment_IN_FLIGHT {
continue
}
payment = p
case <-time.After(5 * time.Second):
t.Fatalf("in flight status not recevied")
}
}
// Assert terminal payment state.
if i%2 == 0 {
if payment.Status != lnrpc.Payment_SUCCEEDED {
t.Fatalf("state not suceeded : %v",
payment.Status)
}
} else {
if payment.FailureReason !=
lnrpc.PaymentFailureReason_FAILURE_REASON_INCORRECT_PAYMENT_DETAILS {
t.Fatalf("state not failed: %v",
payment.FailureReason)
}
case <-time.After(5 * time.Second):
t.Fatalf("in flight status not recevied")
}
}

@ -1,11 +1,12 @@
package routing
import (
"errors"
"sync"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/multimutex"
"github.com/lightningnetwork/lnd/queue"
)
// ControlTower tracks all outgoing payments made, whose primary purpose is to
@ -50,29 +51,43 @@ type ControlTower interface {
FetchInFlightPayments() ([]*channeldb.InFlightPayment, error)
// SubscribePayment subscribes to updates for the payment with the given
// hash. It returns a boolean indicating whether the payment is still in
// flight and a channel that provides the final outcome of the payment.
SubscribePayment(paymentHash lntypes.Hash) (bool, chan PaymentResult,
// hash. A first update with the current state of the payment is always
// sent out immediately.
SubscribePayment(paymentHash lntypes.Hash) (*ControlTowerSubscriber,
error)
}
// PaymentResult is the struct describing the events received by payment
// subscribers.
type PaymentResult struct {
// Success indicates whether the payment was successful.
Success bool
// ControlTowerSubscriber contains the state for a payment update subscriber.
type ControlTowerSubscriber struct {
// Updates is the channel over which *channeldb.MPPayment updates can be
// received.
Updates <-chan interface{}
// Preimage is the preimage of a successful payment. This serves as a
// proof of payment. It is only set for successful payments.
Preimage lntypes.Preimage
queue *queue.ConcurrentQueue
quit chan struct{}
}
// FailureReason is a failure reason code indicating the reason the
// payment failed. It is only set for failed payments.
FailureReason channeldb.FailureReason
// newControlTowerSubscriber instantiates a new subscriber state object.
func newControlTowerSubscriber() *ControlTowerSubscriber {
// Create a queue for payment updates.
queue := queue.NewConcurrentQueue(20)
queue.Start()
// HTLCs is a list of HTLCs that have been attempted in order to settle
// the payment.
HTLCs []channeldb.HTLCAttempt
return &ControlTowerSubscriber{
Updates: queue.ChanOut(),
queue: queue,
quit: make(chan struct{}),
}
}
// Close signals that the subscriber is no longer interested in updates.
func (s *ControlTowerSubscriber) Close() {
// Close quit channel so that any pending writes to the queue are
// cancelled.
close(s.quit)
// Stop the queue goroutine so that it won't leak.
s.queue.Stop()
}
// controlTower is persistent implementation of ControlTower to restrict
@ -80,15 +95,21 @@ type PaymentResult struct {
type controlTower struct {
db *channeldb.PaymentControl
subscribers map[lntypes.Hash][]chan PaymentResult
subscribers map[lntypes.Hash][]*ControlTowerSubscriber
subscribersMtx sync.Mutex
// paymentsMtx provides synchronization on the payment level to ensure
// that no race conditions occur in between updating the database and
// sending a notification.
paymentsMtx *multimutex.HashMutex
}
// NewControlTower creates a new instance of the controlTower.
func NewControlTower(db *channeldb.PaymentControl) ControlTower {
return &controlTower{
db: db,
subscribers: make(map[lntypes.Hash][]chan PaymentResult),
subscribers: make(map[lntypes.Hash][]*ControlTowerSubscriber),
paymentsMtx: multimutex.NewHashMutex(),
}
}
@ -107,8 +128,18 @@ func (p *controlTower) InitPayment(paymentHash lntypes.Hash,
func (p *controlTower) RegisterAttempt(paymentHash lntypes.Hash,
attempt *channeldb.HTLCAttemptInfo) error {
_, err := p.db.RegisterAttempt(paymentHash, attempt)
return err
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.RegisterAttempt(paymentHash, attempt)
if err != nil {
return err
}
// Notify subscribers of the attempt registration.
p.notifySubscribers(paymentHash, payment)
return nil
}
// SettleAttempt marks the given attempt settled with the preimage. If
@ -117,15 +148,16 @@ func (p *controlTower) RegisterAttempt(paymentHash lntypes.Hash,
func (p *controlTower) SettleAttempt(paymentHash lntypes.Hash,
attemptID uint64, settleInfo *channeldb.HTLCSettleInfo) error {
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.SettleAttempt(paymentHash, attemptID, settleInfo)
if err != nil {
return err
}
// Notify subscribers of success event.
p.notifyFinalEvent(
paymentHash, createSuccessResult(payment.HTLCs),
)
p.notifySubscribers(paymentHash, payment)
return nil
}
@ -134,8 +166,18 @@ func (p *controlTower) SettleAttempt(paymentHash lntypes.Hash,
func (p *controlTower) FailAttempt(paymentHash lntypes.Hash,
attemptID uint64, failInfo *channeldb.HTLCFailInfo) error {
_, err := p.db.FailAttempt(paymentHash, attemptID, failInfo)
return err
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.FailAttempt(paymentHash, attemptID, failInfo)
if err != nil {
return err
}
// Notify subscribers of failed attempt.
p.notifySubscribers(paymentHash, payment)
return nil
}
// FetchPayment fetches the payment corresponding to the given payment hash.
@ -145,35 +187,6 @@ func (p *controlTower) FetchPayment(paymentHash lntypes.Hash) (
return p.db.FetchPayment(paymentHash)
}
// createSuccessResult creates a success result to send to subscribers.
func createSuccessResult(htlcs []channeldb.HTLCAttempt) *PaymentResult {
// Extract any preimage from the list of HTLCs.
var preimage lntypes.Preimage
for _, htlc := range htlcs {
if htlc.Settle != nil {
preimage = htlc.Settle.Preimage
break
}
}
return &PaymentResult{
Success: true,
Preimage: preimage,
HTLCs: htlcs,
}
}
// createFailResult creates a failed result to send to subscribers.
func createFailedResult(htlcs []channeldb.HTLCAttempt,
reason channeldb.FailureReason) *PaymentResult {
return &PaymentResult{
Success: false,
FailureReason: reason,
HTLCs: htlcs,
}
}
// Fail transitions a payment into the Failed state, and records the reason the
// payment failed. After invoking this method, InitPayment should return nil on
// its next call for this payment hash, allowing the switch to make a
@ -181,17 +194,16 @@ func createFailedResult(htlcs []channeldb.HTLCAttempt,
func (p *controlTower) Fail(paymentHash lntypes.Hash,
reason channeldb.FailureReason) error {
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.Fail(paymentHash, reason)
if err != nil {
return err
}
// Notify subscribers of fail event.
p.notifyFinalEvent(
paymentHash, createFailedResult(
payment.HTLCs, reason,
),
)
p.notifySubscribers(paymentHash, payment)
return nil
}
@ -201,86 +213,81 @@ func (p *controlTower) FetchInFlightPayments() ([]*channeldb.InFlightPayment, er
return p.db.FetchInFlightPayments()
}
// SubscribePayment subscribes to updates for the payment with the given hash.
// It returns a boolean indicating whether the payment is still in flight and a
// channel that provides the final outcome of the payment.
// SubscribePayment subscribes to updates for the payment with the given hash. A
// first update with the current state of the payment is always sent out
// immediately.
func (p *controlTower) SubscribePayment(paymentHash lntypes.Hash) (
bool, chan PaymentResult, error) {
*ControlTowerSubscriber, error) {
// Create a channel with buffer size 1. For every payment there will be
// exactly one event sent.
c := make(chan PaymentResult, 1)
// Take lock before querying the db to prevent this scenario:
// FetchPayment returns us an in-flight state -> payment succeeds, but
// there is no subscriber to notify yet -> we add ourselves as a
// subscriber -> ... we will never receive a notification.
p.subscribersMtx.Lock()
defer p.subscribersMtx.Unlock()
// Take lock before querying the db to prevent missing or duplicating an
// update.
p.paymentsMtx.Lock(paymentHash)
defer p.paymentsMtx.Unlock(paymentHash)
payment, err := p.db.FetchPayment(paymentHash)
if err != nil {
return false, nil, err
return nil, err
}
var event PaymentResult
subscriber := newControlTowerSubscriber()
switch payment.Status {
// Always write current payment state to the channel.
subscriber.queue.ChanIn() <- payment
// Payment is currently in flight. Register this subscriber and
// return without writing a result to the channel yet.
case channeldb.StatusInFlight:
// Payment is currently in flight. Register this subscriber for further
// updates. Otherwise this update is the final update and the incoming
// channel can be closed. This will close the queue's outgoing channel
// when all updates have been written.
if payment.Status == channeldb.StatusInFlight {
p.subscribersMtx.Lock()
p.subscribers[paymentHash] = append(
p.subscribers[paymentHash], c,
p.subscribers[paymentHash], subscriber,
)
return true, c, nil
// Payment already succeeded. It is not necessary to register as
// a subscriber, because we can send the result on the channel
// immediately.
case channeldb.StatusSucceeded:
event = *createSuccessResult(payment.HTLCs)
// Payment already failed. It is not necessary to register as a
// subscriber, because we can send the result on the channel
// immediately.
case channeldb.StatusFailed:
event = *createFailedResult(
payment.HTLCs, *payment.FailureReason,
)
default:
return false, nil, errors.New("unknown payment status")
p.subscribersMtx.Unlock()
} else {
close(subscriber.queue.ChanIn())
}
// Write immediate result to the channel.
c <- event
close(c)
return false, c, nil
return subscriber, nil
}
// notifyFinalEvent sends a final payment event to all subscribers of this
// payment. The channel will be closed after this.
func (p *controlTower) notifyFinalEvent(paymentHash lntypes.Hash,
event *PaymentResult) {
// notifySubscribers sends a final payment event to all subscribers of this
// payment. The channel will be closed after this. Note that this function must
// be executed atomically (by means of a lock) with the database update to
// guarantuee consistency of the notifications.
func (p *controlTower) notifySubscribers(paymentHash lntypes.Hash,
event *channeldb.MPPayment) {
// Get all subscribers for this hash. As there is only a single outcome,
// the subscriber list can be cleared.
// Get all subscribers for this payment.
p.subscribersMtx.Lock()
list, ok := p.subscribers[paymentHash]
if !ok {
p.subscribersMtx.Unlock()
return
}
delete(p.subscribers, paymentHash)
// If the payment reached a terminal state, the subscriber list can be
// cleared. There won't be any more updates.
terminal := event.Status != channeldb.StatusInFlight
if terminal {
delete(p.subscribers, paymentHash)
}
p.subscribersMtx.Unlock()
// Notify all subscribers of the event. The subscriber channel is
// buffered, so it cannot block here.
// Notify all subscribers of the event.
for _, subscriber := range list {
subscriber <- *event
close(subscriber)
select {
case subscriber.queue.ChanIn() <- event:
// If this event is the last, close the incoming channel
// of the queue. This will signal the subscriber that
// there won't be any more updates.
if terminal {
close(subscriber.queue.ChanIn())
}
// If subscriber disappeared, skip notification. For further
// notifications, we'll keep skipping over this subscriber.
case <-subscriber.quit:
}
}
}

@ -55,7 +55,7 @@ func TestControlTowerSubscribeUnknown(t *testing.T) {
pControl := NewControlTower(channeldb.NewPaymentControl(db))
// Subscription should fail when the payment is not known.
_, _, err = pControl.SubscribePayment(lntypes.Hash{1})
_, err = pControl.SubscribePayment(lntypes.Hash{1})
if err != channeldb.ErrPaymentNotInitiated {
t.Fatal("expected subscribe to fail for unknown payment")
}
@ -86,13 +86,10 @@ func TestControlTowerSubscribeSuccess(t *testing.T) {
// Subscription should succeed and immediately report the InFlight
// status.
inFlight, subscriber1, err := pControl.SubscribePayment(info.PaymentHash)
subscriber1, err := pControl.SubscribePayment(info.PaymentHash)
if err != nil {
t.Fatalf("expected subscribe to succeed, but got: %v", err)
}
if !inFlight {
t.Fatalf("unexpected payment to be in flight")
}
// Register an attempt.
err = pControl.RegisterAttempt(info.PaymentHash, attempt)
@ -101,13 +98,10 @@ func TestControlTowerSubscribeSuccess(t *testing.T) {
}
// Register a second subscriber after the first attempt has started.
inFlight, subscriber2, err := pControl.SubscribePayment(info.PaymentHash)
subscriber2, err := pControl.SubscribePayment(info.PaymentHash)
if err != nil {
t.Fatalf("expected subscribe to succeed, but got: %v", err)
}
if !inFlight {
t.Fatalf("unexpected payment to be in flight")
}
// Mark the payment as successful.
err = pControl.SettleAttempt(
@ -121,32 +115,33 @@ func TestControlTowerSubscribeSuccess(t *testing.T) {
}
// Register a third subscriber after the payment succeeded.
inFlight, subscriber3, err := pControl.SubscribePayment(info.PaymentHash)
subscriber3, err := pControl.SubscribePayment(info.PaymentHash)
if err != nil {
t.Fatalf("expected subscribe to succeed, but got: %v", err)
}
if inFlight {
t.Fatalf("expected payment to be finished")
}
// We expect all subscribers to now report the final outcome followed by
// no other events.
subscribers := []chan PaymentResult{
subscribers := []*ControlTowerSubscriber{
subscriber1, subscriber2, subscriber3,
}
for _, s := range subscribers {
var result PaymentResult
select {
case result = <-s:
case <-time.After(testTimeout):
t.Fatal("timeout waiting for payment result")
var result *channeldb.MPPayment
for result == nil || result.Status == channeldb.StatusInFlight {
select {
case item := <-s.Updates:
result = item.(*channeldb.MPPayment)
case <-time.After(testTimeout):
t.Fatal("timeout waiting for payment result")
}
}
if !result.Success {
if result.Status != channeldb.StatusSucceeded {
t.Fatal("unexpected payment state")
}
if result.Preimage != preimg {
settle, _ := result.TerminalInfo()
if settle.Preimage != preimg {
t.Fatal("unexpected preimage")
}
if len(result.HTLCs) != 1 {
@ -161,7 +156,7 @@ func TestControlTowerSubscribeSuccess(t *testing.T) {
// After the final event, we expect the channel to be closed.
select {
case _, ok := <-s:
case _, ok := <-s.Updates:
if ok {
t.Fatal("expected channel to be closed")
}
@ -204,7 +199,7 @@ func testPaymentControlSubscribeFail(t *testing.T, registerAttempt bool) {
}
// Subscription should succeed.
_, subscriber1, err := pControl.SubscribePayment(info.PaymentHash)
subscriber1, err := pControl.SubscribePayment(info.PaymentHash)
if err != nil {
t.Fatalf("expected subscribe to succeed, but got: %v", err)
}
@ -235,29 +230,29 @@ func testPaymentControlSubscribeFail(t *testing.T, registerAttempt bool) {
}
// Register a second subscriber after the payment failed.
inFlight, subscriber2, err := pControl.SubscribePayment(info.PaymentHash)
subscriber2, err := pControl.SubscribePayment(info.PaymentHash)
if err != nil {
t.Fatalf("expected subscribe to succeed, but got: %v", err)
}
if inFlight {
t.Fatalf("expected payment to be finished")
}
// We expect all subscribers to now report the final outcome followed by
// no other events.
subscribers := []chan PaymentResult{
subscribers := []*ControlTowerSubscriber{
subscriber1, subscriber2,
}
for _, s := range subscribers {
var result PaymentResult
select {
case result = <-s:
case <-time.After(testTimeout):
t.Fatal("timeout waiting for payment result")
var result *channeldb.MPPayment
for result == nil || result.Status == channeldb.StatusInFlight {
select {
case item := <-s.Updates:
result = item.(*channeldb.MPPayment)
case <-time.After(testTimeout):
t.Fatal("timeout waiting for payment result")
}
}
if result.Success {
if result.Status == channeldb.StatusSucceeded {
t.Fatal("unexpected payment state")
}
@ -282,13 +277,13 @@ func testPaymentControlSubscribeFail(t *testing.T, registerAttempt bool) {
len(result.HTLCs))
}
if result.FailureReason != channeldb.FailureReasonTimeout {
if *result.FailureReason != channeldb.FailureReasonTimeout {
t.Fatal("unexpected failure reason")
}
// After the final event, we expect the channel to be closed.
select {
case _, ok := <-s:
case _, ok := <-s.Updates:
if ok {
t.Fatal("expected channel to be closed")
}

@ -457,7 +457,7 @@ func (m *mockControlTower) FetchInFlightPayments() (
}
func (m *mockControlTower) SubscribePayment(paymentHash lntypes.Hash) (
bool, chan PaymentResult, error) {
*ControlTowerSubscriber, error) {
return false, nil, errors.New("not implemented")
return nil, errors.New("not implemented")
}