tlnrouter: use htlc_maximum_msat - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 52377dbfa04072e2296426a6db2e921157bd6da0 (DIR) parent ff0aa90ddf5c461105d0c798fa8f98f4db57d0be (HTM) Author: SomberNight <somber.night@protonmail.com> Date: Tue, 16 Oct 2018 17:08:44 +0200 lnrouter: use htlc_maximum_msat Diffstat: M electrum/lnrouter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- (DIR) diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py t@@ -150,7 +150,7 @@ class ChannelInfoDirectedPolicy: fee_proportional_millionths = channel_update_payload['fee_proportional_millionths'] channel_flags = channel_update_payload['channel_flags'] timestamp = channel_update_payload['timestamp'] - htlc_maximum_msat = channel_update_payload.get('htlc_maximum_msat') # optional + htlc_maximum_msat = channel_update_payload.get('htlc_maximum_msat') # optional self.cltv_expiry_delta = int.from_bytes(cltv_expiry_delta, "big") self.htlc_minimum_msat = int.from_bytes(htlc_minimum_msat, "big") t@@ -497,7 +497,7 @@ class LNPathFinder(PrintError): """Heuristic cost of going through a channel. direction: 0 or 1. --- 0 means node_id_1 -> node_id_2 """ - channel_info = self.channel_db.get_channel_info(short_channel_id) + channel_info = self.channel_db.get_channel_info(short_channel_id) # type: ChannelInfo if channel_info is None: return float('inf') t@@ -514,8 +514,11 @@ class LNPathFinder(PrintError): if channel_info.capacity_sat is not None and \ payment_amt_msat // 1000 > channel_info.capacity_sat: return float('inf') # payment amount too large + if channel_policy.htlc_maximum_msat is not None and \ + payment_amt_msat > channel_policy.htlc_maximum_msat: + return float('inf') # payment amount too large amt = payment_amt_msat or 50000 * 1000 # guess for typical payment amount - fee_msat = fee_base_msat + amt * fee_proportional_millionths / 1000000 + fee_msat = fee_base_msat + amt * fee_proportional_millionths / 1_000_000 # TODO revise # paying 10 more satoshis ~ waiting one more block fee_cost = fee_msat / 1000 / 10