From 5416decde2bb476d34caad3b279aacd0cc23e31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1lli=20Zolt=C3=A1n?= Date: Tue, 7 May 2019 09:58:16 +0200 Subject: [PATCH] rebalance: exclude all own channels from getroute fix for #17 --- rebalance/rebalance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rebalance/rebalance.py b/rebalance/rebalance.py index 5ca6ca0..54da95e 100755 --- a/rebalance/rebalance.py +++ b/rebalance/rebalance.py @@ -146,7 +146,10 @@ def rebalance(plugin, outgoing_scid, incoming_scid, msatoshi: Millisatoshi=None, plugin.log("Invoice payment_hash: %s" % payment_hash) success_msg = "" try: - excludes = [outgoing_scid + "/0", incoming_scid + "/0"] + excludes = [] + mychannels = plugin.rpc.listchannels(source=my_node_id)['channels'] + for channel in mychannels: + excludes += [channel['short_channel_id'] + '/0', channel['short_channel_id'] + '/1'] while int(time.time()) - start_ts < int(retry_for): r = plugin.rpc.getroute(incoming_node_id, msatoshi, riskfactor=1, cltv=9, fromid=outgoing_node_id, exclude=excludes)