lnworker: fix handle_error_code_from_failed_htlc for private channels
if the last (private) edge of the route errors, we need to try other route hints (if any)
This commit is contained in:
@@ -610,12 +610,20 @@ class ChannelDB(SqlDB):
|
||||
self.update_counts()
|
||||
self.logger.info(f'Deleting {len(orphaned_chans)} orphaned channels')
|
||||
|
||||
def add_channel_update_for_private_channel(self, msg_payload: dict, start_node_id: bytes):
|
||||
def add_channel_update_for_private_channel(self, msg_payload: dict, start_node_id: bytes) -> bool:
|
||||
"""Returns True iff the channel update was successfully added and it was different than
|
||||
what we had before (if any).
|
||||
"""
|
||||
if not verify_sig_for_channel_update(msg_payload, start_node_id):
|
||||
return # ignore
|
||||
return False # ignore
|
||||
short_channel_id = ShortChannelID(msg_payload['short_channel_id'])
|
||||
msg_payload['start_node'] = start_node_id
|
||||
self._channel_updates_for_private_channels[(start_node_id, short_channel_id)] = msg_payload
|
||||
key = (start_node_id, short_channel_id)
|
||||
prev_chanupd = self._channel_updates_for_private_channels.get(key)
|
||||
if prev_chanupd == msg_payload:
|
||||
return False
|
||||
self._channel_updates_for_private_channels[key] = msg_payload
|
||||
return True
|
||||
|
||||
def remove_channel(self, short_channel_id: ShortChannelID):
|
||||
# FIXME what about rm-ing policies?
|
||||
|
||||
@@ -1224,8 +1224,8 @@ class LNWallet(LNWorker):
|
||||
# maybe it is a private channel (and data in invoice was outdated)
|
||||
self.logger.info(f"Could not find {short_channel_id}. maybe update is for private channel?")
|
||||
start_node_id = route[sender_idx].node_id
|
||||
self.channel_db.add_channel_update_for_private_channel(payload, start_node_id)
|
||||
#update = True # FIXME: we need to check if we actually updated something
|
||||
update = self.channel_db.add_channel_update_for_private_channel(payload, start_node_id)
|
||||
blacklist = not update
|
||||
elif r == UpdateStatus.EXPIRED:
|
||||
blacklist = True
|
||||
elif r == UpdateStatus.DEPRECATED:
|
||||
@@ -1568,6 +1568,8 @@ class LNWallet(LNWorker):
|
||||
if [edge.short_channel_id for edge in full_path[-len(private_path):]] != [edge[1] for edge in private_path]:
|
||||
continue
|
||||
path = full_path[:-len(private_path)]
|
||||
if any(edge.short_channel_id in blacklist for edge in private_route):
|
||||
continue
|
||||
try:
|
||||
route = self.network.path_finder.find_route(
|
||||
self.node_keypair.pubkey, border_node_pubkey, amount_for_node,
|
||||
|
||||
Reference in New Issue
Block a user