1
0

remove_channel_backup: a channel backup might be in both lists

This commit is contained in:
ThomasV
2022-07-20 17:00:57 +02:00
parent 90610de58e
commit af1fb1ae9f

View File

@@ -2511,13 +2511,16 @@ class LNWallet(LNWorker):
def remove_channel_backup(self, channel_id):
chan = self.channel_backups[channel_id]
assert chan.can_be_deleted()
found = False
onchain_backups = self.db.get_dict("onchain_channel_backups")
imported_backups = self.db.get_dict("imported_channel_backups")
if channel_id.hex() in onchain_backups:
onchain_backups.pop(channel_id.hex())
elif channel_id.hex() in imported_backups:
found = True
if channel_id.hex() in imported_backups:
imported_backups.pop(channel_id.hex())
else:
found = True
if not found:
raise Exception('Channel not found')
with self.lock:
self._channel_backups.pop(channel_id)