From 967ff12ca0bcefff0a4cf8a5e4edb70bca9e42bb Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Tue, 31 Aug 2021 10:32:37 +0200 Subject: [PATCH] autopilot: nits and missing docstrings --- autopilot/autopilot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/autopilot/autopilot.py b/autopilot/autopilot.py index f7e0d8b..6698ba9 100755 --- a/autopilot/autopilot.py +++ b/autopilot/autopilot.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 -from bech32 import bech32_decode, CHARSET, convertbits +from bech32 import bech32_decode, convertbits from lib_autopilot import Autopilot, Strategy -from pyln.client import LightningRpc, Plugin, RpcError +from pyln.client import Plugin, RpcError import random import threading import math @@ -92,7 +92,7 @@ class CLightning_autopilot(Autopilot): print("Attempt RPC-call to download channels from the lightning network") channels = self.__rpc_interface.listchannels()["channels"] print("Number of retrieved channels: {}".format(len(channels))) - except ValueError as e: + except ValueError: print("Channel list could not be retrieved from the peers of the lightning network") return False @@ -138,6 +138,12 @@ def init(configuration, options, plugin): @plugin.method('autopilot-run-once') def run_once(plugin, dryrun=False): + """ + Run the autopilot manually one time. + + The argument 'dryrun' can be set to True in order to just output what would + be done without actually opening any channels. + """ # Let's start by inspecting the current state of the node funds = plugin.rpc.listfunds() awaiting_lockin_funds = sum([o['channel_sat'] for o in funds['channels'] if o['state'] == 'CHANNELD_AWAITING_LOCKIN'])