follow-up previous commit
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user