From d219c0abc1261c1542ac25cd14e93be9f6fd35c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1lli=20Zolt=C3=A1n?= Date: Mon, 8 Feb 2021 14:13:32 +0100 Subject: [PATCH] rebalance: measure and log HTLC settlement time log messages show how much time need for an HTLC settlement --- rebalance/rebalance.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rebalance/rebalance.py b/rebalance/rebalance.py index c4098af..0ccc232 100755 --- a/rebalance/rebalance.py +++ b/rebalance/rebalance.py @@ -418,13 +418,15 @@ def maybe_rebalance_pairs(plugin: Plugin, ch1, ch2, failed_pairs: list): if amount > get_max_amount(i, plugin): continue return result - elapsed_time = timedelta(seconds=time.time() - start_ts) - res["elapsed_time"] = str(elapsed_time)[:-3] - plugin.log(f"Rebalance succeeded: {res}") result["success"] = True result["fee_spent"] += res["fee"] + htlc_start_ts = time.time() # wait for settlement wait_for_htlcs(plugin, [scid1, scid2]) + current_ts = time.time() + res["elapsed_time"] = str(timedelta(seconds=current_ts - start_ts))[:-3] + res["htlc_time"] = str(timedelta(seconds=current_ts - htlc_start_ts))[:-3] + plugin.log(f"Rebalance succeeded: {res}") ch1 = get_chan(plugin, scid1) assert ch1 is not None ch2 = get_chan(plugin, scid2)