electrum

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

commit 436c313790c700442402adbdcc2fe3a15a5f54b3
parent 46aa5c19584a1118deabb9dc2a6eba6012d38509
Author: ThomasV <thomasv@electrum.org>
Date:   Tue,  5 Mar 2019 17:37:01 +0100

follow-up previous commit

Diffstat:
Melectrum/lnrouter.py | 8++++----
Melectrum/lnworker.py | 4++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/electrum/lnrouter.py b/electrum/lnrouter.py @@ -521,16 +521,16 @@ class ChannelDB(PrintError): old_policy.timestamp = new_policy.timestamp @sql - def get_policy_for_node(self, node) -> Optional['Policy']: + def get_policy_for_node(self, channel_info, node) -> Optional['Policy']: """ raises when initiator/non-initiator both unequal node """ - if node.hex() not in (self.node1_id, self.node2_id): + if node.hex() not in (channel_info.node1_id, channel_info.node2_id): raise Exception("the given node is not a party in this channel") - n1 = self.DBSession.query(Policy).filter_by(short_channel_id = self.short_channel_id, start_node = self.node1_id).one_or_none() + n1 = self.DBSession.query(Policy).filter_by(short_channel_id = channel_info.short_channel_id, start_node = channel_info.node1_id).one_or_none() if n1: return n1 - n2 = self.DBSession.query(Policy).filter_by(short_channel_id = self.short_channel_id, start_node = self.node2_id).one_or_none() + n2 = self.DBSession.query(Policy).filter_by(short_channel_id = channel_info.short_channel_id, start_node = channel_info.node2_id).one_or_none() return n2 @sql diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -635,7 +635,7 @@ class LNWorker(PrintError): cltv_expiry_delta = 1 # lnd won't even try with zero missing_info = True if channel_info: - policy = channel_info.get_policy_for_node(chan.node_id) + policy = self.channel_db.get_policy_for_node(channel_info, chan.node_id) if policy: fee_base_msat = policy.fee_base_msat fee_proportional_millionths = policy.fee_proportional_millionths @@ -774,7 +774,7 @@ class LNWorker(PrintError): await self.add_peer(peer.host, peer.port, peer.pubkey) return # try random address for node_id - node_info = await self.channel_db._nodes_get(chan.node_id) + node_info = self.channel_db.nodes_get(chan.node_id) if not node_info: return addresses = self.channel_db.get_node_addresses(node_info) if not addresses: return