diff --git a/feeadjuster/feeadjuster.py b/feeadjuster/feeadjuster.py index 8a6b213..8738b92 100755 --- a/feeadjuster/feeadjuster.py +++ b/feeadjuster/feeadjuster.py @@ -113,10 +113,7 @@ def setchannelfee(plugin: Plugin, scid: str, base: int, ppm: int): if fees is None or base == fees['base'] and ppm == fees['ppm']: return False try: - if plugin.rpcfeemethod == 'setchannel': - plugin.rpc.setchannel(scid, base, ppm) # new method - else: - plugin.rpc.setchannelfee(scid, base, ppm) # deprecated + plugin.rpc.setchannel(scid, base, ppm) return True except RpcError as e: plugin.log(f"Could not adjust fees for channel {scid}: '{e}'", level="error") @@ -303,10 +300,10 @@ def init(options: dict, configuration: dict, plugin: Plugin, **kwargs): and "destination" in c["command"]]) == 1: plugin.listchannels_by_dst = True - # detect if server supports new 'setchannel' command over setchannelfee - plugin.rpcfeemethod = 'setchannelfee' - if len([c for c in rpchelp if c["command"].startswith("setchannel ")]) == 1: - plugin.rpcfeemethod = 'setchannel' + # Detect if server supports new 'setchannel' command over setchannelfee. + # If not, make plugin.rpc.setchannel a 'symlink' to setchannelfee + if len([c for c in rpchelp if c["command"].startswith("setchannel ")]) == 0: + plugin.rpc.setchannel = plugin.rpc.setchannelfee plugin.log(f"Plugin feeadjuster initialized " f"({plugin.adj_basefee} base / {plugin.adj_ppmfee} ppm) with an "