electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0e420e6f9d6bd82786e3b873f14c81a556e8e282
parent e83f0dd3fc4e19c8845fc21f344400f1b0a7eebf
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 15 Dec 2020 15:34:26 +0100

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

Diffstat:
Melectrum/lnworker.py | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/electrum/lnworker.py b/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: