remove_channel_backup: a channel backup might be in both lists
This commit is contained in:
@@ -2511,13 +2511,16 @@ class LNWallet(LNWorker):
|
|||||||
def remove_channel_backup(self, channel_id):
|
def remove_channel_backup(self, channel_id):
|
||||||
chan = self.channel_backups[channel_id]
|
chan = self.channel_backups[channel_id]
|
||||||
assert chan.can_be_deleted()
|
assert chan.can_be_deleted()
|
||||||
|
found = False
|
||||||
onchain_backups = self.db.get_dict("onchain_channel_backups")
|
onchain_backups = self.db.get_dict("onchain_channel_backups")
|
||||||
imported_backups = self.db.get_dict("imported_channel_backups")
|
imported_backups = self.db.get_dict("imported_channel_backups")
|
||||||
if channel_id.hex() in onchain_backups:
|
if channel_id.hex() in onchain_backups:
|
||||||
onchain_backups.pop(channel_id.hex())
|
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())
|
imported_backups.pop(channel_id.hex())
|
||||||
else:
|
found = True
|
||||||
|
if not found:
|
||||||
raise Exception('Channel not found')
|
raise Exception('Channel not found')
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self._channel_backups.pop(channel_id)
|
self._channel_backups.pop(channel_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user