Merge pull request #15 from ziggie1984/show_ppm

pull/18/head
rkfg 2 years ago committed by GitHub
commit 080f0c7f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,3 +44,8 @@ func formatFee(amtMsat int64) string {
}
return hiWhiteColor(amtMsat / 1000)
}
func formatFeePPM(amtMsat int64, feeMsat int64) string {
return hiWhiteColor(int64(float64(feeMsat) / float64(amtMsat) * 1e6))
}

@ -160,8 +160,8 @@ func tryRebalance(ctx context.Context, r *regolancer, attempt *int) (err error,
}
routeCtxCancel()
for _, route := range routes {
log.Printf("Attempt %s, amount: %s (max fee: %s)",
hiWhiteColorF("#%d", *attempt), hiWhiteColor(amt), formatFee(fee))
log.Printf("Attempt %s, amount: %s (max fee: %s sat | %s ppm )",
hiWhiteColorF("#%d", *attempt), hiWhiteColor(amt), formatFee(fee), formatFeePPM(amt*1000, fee))
r.printRoute(ctx, route)
err = r.pay(ctx, amt, params.MinAmount, route, params.ProbeSteps)
if err == nil {

@ -132,8 +132,8 @@ func (r *regolancer) printRoute(ctx context.Context, route *lnrpc.Route) {
return
}
errs := ""
fmt.Printf("%s %s\n", faintWhiteColor("Total fee:"),
formatFee(route.TotalFeesMsat))
fmt.Printf("%s %s sat | %s ppm\n", faintWhiteColor("Total fee:"),
formatFee(route.TotalFeesMsat), formatFeePPM(route.TotalAmtMsat, route.TotalFeesMsat))
for i, hop := range route.Hops {
nodeInfo, err := r.getNodeInfo(ctx, hop.PubKey)
if err != nil {

Loading…
Cancel
Save