servo: clightning-sane: rename ppm in/out to theirs/mine

This commit is contained in:
Colin 2024-01-12 19:31:39 +00:00
parent 805b37a9a5
commit 432170a69e

View File

@ -109,20 +109,20 @@ class LocalChannel:
self.peer_ch = rpc.peerchannel(self.scid, self.remote_peer)
def __repr__(self) -> str:
return self.to_str(with_scid=True, with_bal_ratio=True, with_cost=True, with_ppm_out=True)
return self.to_str(with_scid=True, with_bal_ratio=True, with_cost=True, with_ppm_theirs=True)
def to_str(self, with_scid: bool=False, with_bal_msat: bool=False, with_bal_ratio: bool=False, with_cost:bool = False, with_ppm_out:bool = False, with_ppm_in:bool = False) -> str:
def to_str(self, with_scid: bool=False, with_bal_msat: bool=False, with_bal_ratio: bool=False, with_cost:bool = False, with_ppm_theirs:bool = False, with_ppm_mine:bool = False) -> str:
base_flag = "*" if self.to_me is None or self.to_me["base_fee_millisatoshi"] != 0 else ""
alias = f"({self.remote_alias}){base_flag}"
scid = f" scid:{self.scid:>13}" if with_scid else ""
bal = f" S:{int(self.sendable):11}/R:{int(self.receivable):11}" if with_bal_msat else ""
ratio = f" MINE:{(100*self.send_ratio):>8.4f}%" if with_bal_ratio else ""
cost = f" COST:{self.opportunity_cost_lent:>11}" if with_cost else ""
ppm_out = self.to_me["fee_per_millionth"] if self.to_me else "N/A"
ppm_out = f" PPM_TO:{ppm_out:>6}" if with_ppm_out else ""
ppm_in = self.from_me["fee_per_millionth"] if self.from_me else "N/A"
ppm_in = f" PPM_TO:{ppm_in:>6}" if with_ppm_in else ""
return f"channel{alias:30}{scid}{bal}{ratio}{cost}{ppm_out}{ppm_in}"
ppm_theirs = self.to_me["fee_per_millionth"] if self.to_me else "N/A"
ppm_theirs = f" PPM_THEIRS:{ppm_theirs:>6}" if with_ppm_theirs else ""
ppm_mine = self.from_me["fee_per_millionth"] if self.from_me else "N/A"
ppm_mine = f" PPM_MINE:{ppm_mine:>6}" if with_ppm_mine else ""
return f"channel{alias:30}{scid}{bal}{ratio}{cost}{ppm_theirs}{ppm_mine}"
@property
@ -396,7 +396,7 @@ def show_status(rpc: RpcHelper, full: bool=False):
"""
for ch in rpc.rpc.listpeerchannels()["channels"]:
ch = rpc.localchannel(ch["short_channel_id"])
print(ch.to_str(with_scid=True, with_bal_ratio=True, with_cost=True, with_ppm_out=True, with_ppm_in=full))
print(ch.to_str(with_scid=True, with_bal_ratio=True, with_cost=True, with_ppm_theirs=True, with_ppm_mine=full))
def main():
logging.basicConfig()