1
0

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:
SomberNight
2021-03-01 21:26:05 +01:00
parent b3b87555dc
commit 1139720b58
2 changed files with 15 additions and 5 deletions

View File

@@ -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?