mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-13 12:33:20 +02:00
clboss-xrebalance-view: add an On column showing peer online/offline
Adds an "On" column immediately after the opener "O" column: "." when the peer is connected, "X" when it is offline. Sourced from listpeerchannels' peer_connected field. Offline peers cannot be rebalanced through, so flagging them makes it obvious why a suggested source/dest endpoint is unreachable. The TOTALS rows and CSV output are updated to keep column alignment.
This commit is contained in:
parent
f58bdc54bf
commit
692c80db90
1 changed files with 6 additions and 1 deletions
|
|
@ -224,6 +224,8 @@ def compute_row(channel, peer, window_days):
|
|||
"alias": peer.get("alias") or "",
|
||||
"scid": channel.get("scid"),
|
||||
"opener": "L" if channel.get("opener") == "local" else "R",
|
||||
# '.' connected, 'X' offline -- offline peers can't be rebalanced through
|
||||
"online": "." if channel.get("peer_connected") else "X",
|
||||
"cap_sat": cap_sat,
|
||||
"pct_local": pct_local,
|
||||
"local_sat": local_sat,
|
||||
|
|
@ -380,6 +382,7 @@ def main():
|
|||
"scid": scid,
|
||||
"peer_id": peer_id,
|
||||
"opener": ch.get("opener"),
|
||||
"peer_connected": ch.get("peer_connected", False),
|
||||
"to_us_msat": ch.get("to_us_msat", 0),
|
||||
"total_msat": ch.get("total_msat", 0),
|
||||
}
|
||||
|
|
@ -473,7 +476,7 @@ def main():
|
|||
rows.sort(key=sort_keys[args.sort])
|
||||
|
||||
headers = [
|
||||
"Alias", "SCID", "O",
|
||||
"Alias", "SCID", "O", "On",
|
||||
"Cap sat", "Loc %", "LocalBal", "RemoteBal", "TgtFill", "TgtDrain",
|
||||
"Age d", "Ops d",
|
||||
"InFwd sat", "InEarn", "InExp", "InNet", "InPpm", "InNetPpm",
|
||||
|
|
@ -485,6 +488,7 @@ def main():
|
|||
r["alias"],
|
||||
r["scid"],
|
||||
r["opener"],
|
||||
r["online"],
|
||||
fmt_int(r["cap_sat"]),
|
||||
fmt_pct(r["pct_local"]),
|
||||
fmt_int(r["local_sat"]),
|
||||
|
|
@ -539,6 +543,7 @@ def main():
|
|||
pad_string(label, max_alias), # Alias
|
||||
f"n={len(subset)}", # SCID (reused for count)
|
||||
"", # O
|
||||
"", # On
|
||||
fmt_int(total_cap), # Cap sat
|
||||
"", # Loc %
|
||||
fmt_int(total_local), # LocalBal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue