electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit bf1d51695953297421dc7453835af10de9354ce3
parent 391dba7117182237aad4195ce95a28cde999b6aa
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 24 Feb 2021 16:11:15 +0100

lnworker: add fees from private path to the amount passed to find_route.
(see #7050)

Diffstat:
Melectrum/lnworker.py | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -1473,6 +1473,7 @@ class LNWallet(LNWorker): # first try with routing hints, then without for private_path in r_tags + [[]]: private_route = [] + amount_for_node = amount_msat path = full_path if len(private_path) > NUM_MAX_EDGES_IN_PAYMENT_PATH: continue @@ -1507,6 +1508,8 @@ class LNWallet(LNWorker): cltv_expiry_delta=cltv_expiry_delta, node_features=node_info.features if node_info else 0)) prev_node_id = node_pubkey + for edge in private_route[::-1]: + amount_for_node += edge.fee_for_edge(amount_for_node) if full_path: # user pre-selected path. check that end of given path coincides with private_route: if [edge.short_channel_id for edge in full_path[-len(private_path):]] != [edge[1] for edge in private_path]: @@ -1514,7 +1517,7 @@ class LNWallet(LNWorker): path = full_path[:-len(private_path)] try: route = self.network.path_finder.find_route( - self.node_keypair.pubkey, border_node_pubkey, amount_msat, + self.node_keypair.pubkey, border_node_pubkey, amount_for_node, path=path, my_channels=scid_to_my_channels, blacklist=blacklist) except NoChannelPolicy: continue