From fb0f3cbec1eaf50cf34eeaa62c064280d9ce224e Mon Sep 17 00:00:00 2001 From: ziggie Date: Mon, 19 Dec 2022 23:14:19 +0100 Subject: [PATCH] Adding more verbose output and save some rapid rebalances in some cases --- rebalancer.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rebalancer.go b/rebalancer.go index 9a862c5..5e7fc8d 100644 --- a/rebalancer.go +++ b/rebalancer.go @@ -108,6 +108,13 @@ func (r *regolancer) tryRapidRebalance(ctx context.Context, route *lnrpc.Route) for { if hittingTheWall { accelerator >>= 1 + // In case we enounter that we are already constrained + // by the liquidity on the channels we are waiting for + // the accelerator to go below this amount to save + // already failed rebalances + if amtLocal < accelerator*amt && amtLocal > 0 { + continue + } } else { accelerator <<= 1 } @@ -193,7 +200,7 @@ func (r *regolancer) tryRapidRebalance(ctx context.Context, route *lnrpc.Route) return result, err } - log.Printf("rapid fire starting with amount %s", hiWhiteColor(amtLocal)) + log.Printf("Rapid fire starting with actual amount: %s (could be lower than the attempted amount in case there is less liquidity available on the channel)", hiWhiteColor(amtLocal)) routeLocal, err = r.rebuildRoute(ctx, route, amtLocal)