URI: 
       tlnrouter: use 'disable' flags from channel updates in path finding - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit cd893de837def1aee792e0b71af24078aa812810
   DIR parent 15a6a83107607d99079863bffc65805472376784
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Wed,  1 Aug 2018 18:22:23 +0200
       
       lnrouter: use 'disable' flags from channel updates in path finding
       
       Diffstat:
         M electrum/lnrouter.py                |       8 +++++++-
       
       1 file changed, 7 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py
       t@@ -107,7 +107,7 @@ class ChannelInfo(PrintError):
            def on_channel_update(self, msg_payload, trusted=False):
                assert self.channel_id == msg_payload['short_channel_id']
                flags = int.from_bytes(msg_payload['flags'], 'big')
       -        direction = flags & 1
       +        direction = flags & ChannelInfoDirectedPolicy.FLAG_DIRECTION
                new_policy = ChannelInfoDirectedPolicy(msg_payload)
                if direction == 0:
                    old_policy = self.policy_node1
       t@@ -136,6 +136,9 @@ class ChannelInfo(PrintError):
        
        class ChannelInfoDirectedPolicy:
        
       +    FLAG_DIRECTION = 1 << 0
       +    FLAG_DISABLE   = 1 << 1
       +
            def __init__(self, channel_update_payload):
                cltv_expiry_delta           = channel_update_payload['cltv_expiry_delta']
                htlc_minimum_msat           = channel_update_payload['htlc_minimum_msat']
       t@@ -151,6 +154,8 @@ class ChannelInfoDirectedPolicy:
                self.flags                       = int.from_bytes(flags, "big")
                self.timestamp                   = int.from_bytes(timestamp, "big")
        
       +        self.disabled = self.flags & self.FLAG_DISABLE
       +
            def to_json(self) -> dict:
                d = {}
                d['cltv_expiry_delta'] = self.cltv_expiry_delta
       t@@ -495,6 +500,7 @@ class LNPathFinder(PrintError):
        
                channel_policy = channel_info.get_policy_for_node(start_node)
                if channel_policy is None: return float('inf')
       +        if channel_policy.disabled: return float('inf')
                cltv_expiry_delta           = channel_policy.cltv_expiry_delta
                htlc_minimum_msat           = channel_policy.htlc_minimum_msat
                fee_base_msat               = channel_policy.fee_base_msat