1
0

Propagate exceptions raise by force_close to the GUI.

Define 'try_force_closing' for cases where we do not
want exceptions to be raised.
This commit is contained in:
ThomasV
2020-03-06 12:17:26 +01:00
parent 15fb8c0415
commit 888a6d726e
3 changed files with 14 additions and 5 deletions

View File

@@ -732,7 +732,7 @@ class LNWallet(LNWorker):
if chan.get_state() == channel_states.OPEN and self.should_channel_be_closed_due_to_expiring_htlcs(chan):
self.logger.info(f"force-closing due to expiring htlcs")
await self.force_close_channel(chan.channel_id)
await self.try_force_closing(chan.channel_id)
return
if chan.get_state() == channel_states.OPENING:
@@ -1297,11 +1297,19 @@ class LNWallet(LNWorker):
return await peer.close_channel(chan_id)
async def force_close_channel(self, chan_id):
# returns txid or raises
chan = self.channels[chan_id]
tx = chan.force_close_tx()
txid = await self.network.broadcast_transaction(tx)
chan.set_state(channel_states.FORCE_CLOSING)
return txid
async def try_force_closing(self, chan_id):
# fails silently but sets the state, so that we will retry later
chan = self.channels[chan_id]
tx = chan.force_close_tx()
chan.set_state(channel_states.FORCE_CLOSING)
await self.network.try_broadcasting(tx, 'force-close')
return tx.txid()
def remove_channel(self, chan_id):
chan = self.channels[chan_id]