From cd1b751f53040151be89e517222a08b24e7b7aa0 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 10 Jun 2019 13:00:55 +0200 Subject: [PATCH] rebalance: fix route direction This will set the correct `direction` on manual route hops (in/out). Before this was not set, resulting in WIRE_FEE_INSUFFICIENT errors, if fee was calcualted inconsistently with `direction`. --- rebalance/rebalance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rebalance/rebalance.py b/rebalance/rebalance.py index 86f7cf9..c2d1593 100755 --- a/rebalance/rebalance.py +++ b/rebalance/rebalance.py @@ -157,8 +157,8 @@ def rebalance(plugin, outgoing_scid, incoming_scid, msatoshi: Millisatoshi=None, if msatoshi > out_ours or msatoshi > in_total - in_ours: raise RpcError("rebalance", payload, {'message': 'Channel capacities too low'}) - route_out = {'id': outgoing_node_id, 'channel': outgoing_scid} - route_in = {'id': my_node_id, 'channel': incoming_scid} + route_out = {'id': outgoing_node_id, 'channel': outgoing_scid, 'direction': int(not my_node_id < outgoing_node_id)} + route_in = {'id': my_node_id, 'channel': incoming_scid, 'direction': int(not incoming_node_id < my_node_id)} start_ts = int(time.time()) label = "Rebalance-" + str(uuid.uuid4()) description = "%s to %s" % (outgoing_scid, incoming_scid)