Browse Source

lnworker: remove channel if it was not saved successfully after creation

patch-4
ThomasV 4 years ago
parent
commit
0e420e6f9d
  1. 9
      electrum/lnworker.py

9
electrum/lnworker.py

@ -839,8 +839,13 @@ class LNWallet(LNWorker):
channels_db[chan.channel_id.hex()] = chan.storage
for addr in chan.get_wallet_addresses_channel_might_want_reserved():
self.wallet.set_reserved_state_of_address(addr, reserved=True)
self.save_channel(chan)
self.wallet.save_backup()
try:
self.save_channel(chan)
self.wallet.save_backup()
except:
chan.set_state(ChannelState.REDEEMED)
self.remove_channel(chan.channel_id)
raise
def mktx_for_open_channel(self, *, coins: Sequence[PartialTxInput], funding_sat: int,
fee_est=None) -> PartialTransaction:

Loading…
Cancel
Save