From 7d6d8187fb56cb53742fc861a50e581d02fcf2ea Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 16 Jan 2017 20:41:32 -0800 Subject: [PATCH] rpcserver: return full path payments go over in SendPayment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit augments the server’s response to successful SendPayment commands by also returning the full path taken in order to fulfill the payment. With this information, the user now obtains more context about their payment whcih can be useful when debugging, or just exploring the capabilities of the daemon. --- rpcserver.go | 12 +++++++++--- utxonursery.go | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 12338062..eb6c3ca3 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -915,7 +915,9 @@ func (r *rpcServer) SendPayment(paymentStream lnrpc.Lightning_SendPaymentServer) } // TODO(roasbeef): proper responses - resp := &lnrpc.SendResponse{} + resp := &lnrpc.SendResponse{ + PaymentRoute: marshalRoute(route), + } if err := paymentStream.Send(resp); err != nil { errChan <- err return @@ -1560,9 +1562,13 @@ func (r *rpcServer) QueryRoute(_ context.Context, in *lnrpc.RouteRequest) (*lnrp return nil, err } - // If a route exsits within the network that is able to support our + // If a route exists within the network that is able to support our // request, then we'll convert the result into the format required by // the RPC system. + return marshalRoute(route), nil +} + +func marshalRoute(route *routing.Route) *lnrpc.Route { resp := &lnrpc.Route{ TotalTimeLock: route.TotalTimeLock, TotalFees: int64(route.TotalFees), @@ -1578,7 +1584,7 @@ func (r *rpcServer) QueryRoute(_ context.Context, in *lnrpc.RouteRequest) (*lnrp } } - return resp, nil + return resp } // GetNetworkInfo returns some basic stats about the known channel graph from diff --git a/utxonursery.go b/utxonursery.go index 484c4291..ea5f654c 100644 --- a/utxonursery.go +++ b/utxonursery.go @@ -231,6 +231,8 @@ func (u *utxoNursery) catchUpKindergarten() error { } } + utxnLog.Infof("UTXO Nursery is now fully synced") + return nil }