routing/route: report amount per hop in Route.String()
Makes log output slightly more descriptive to aid debugging of routing problems.
This commit is contained in:
parent
de33010e90
commit
85dcaff0d9
@ -340,15 +340,19 @@ func (r *Route) ToSphinxPath() (*sphinx.PaymentPath, error) {
|
|||||||
func (r *Route) String() string {
|
func (r *Route) String() string {
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
|
|
||||||
|
amt := r.TotalAmount
|
||||||
for i, hop := range r.Hops {
|
for i, hop := range r.Hops {
|
||||||
if i > 0 {
|
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",
|
return fmt.Sprintf("%v, cltv %v",
|
||||||
r.TotalAmount-r.TotalFees(), r.TotalFees(), r.TotalTimeLock,
|
b.String(), r.TotalTimeLock,
|
||||||
b.String(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user