From 85dcaff0d99ab0c9829cd49efd7d4a98b8f4287e Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Mon, 11 Nov 2019 12:25:36 +0100 Subject: [PATCH] routing/route: report amount per hop in Route.String() Makes log output slightly more descriptive to aid debugging of routing problems. --- routing/route/route.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/routing/route/route.go b/routing/route/route.go index 62511c3f..6858f3b8 100644 --- a/routing/route/route.go +++ b/routing/route/route.go @@ -340,15 +340,19 @@ func (r *Route) ToSphinxPath() (*sphinx.PaymentPath, error) { func (r *Route) String() string { var b strings.Builder + amt := r.TotalAmount for i, hop := range r.Hops { if i > 0 { - b.WriteString(",") + b.WriteString(" -> ") } - b.WriteString(strconv.FormatUint(hop.ChannelID, 10)) + b.WriteString(fmt.Sprintf("%v (%v)", + strconv.FormatUint(hop.ChannelID, 10), + amt, + )) + amt = hop.AmtToForward } - return fmt.Sprintf("amt=%v, fees=%v, tl=%v, chans=%v", - r.TotalAmount-r.TotalFees(), r.TotalFees(), r.TotalTimeLock, - b.String(), + return fmt.Sprintf("%v, cltv %v", + b.String(), r.TotalTimeLock, ) }