Browse Source

do not co-op close channels with pending htlcs

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
Janus 6 years ago
committed by ThomasV
parent
commit
8a98810df1
  1. 2
      electrum/lnbase.py

2
electrum/lnbase.py

@ -1152,6 +1152,8 @@ class Peer(PrintError):
@log_exceptions @log_exceptions
async def close_channel(self, chan_id: bytes): async def close_channel(self, chan_id: bytes):
chan = self.channels[chan_id] chan = self.channels[chan_id]
if len(chan.htlcs(LOCAL, only_pending=True)) > 0:
raise Exception('Can\'t co-operatively close channel with payments ongoing (pending HTLCs). Please wait, or force-close the channel.')
self.shutdown_received[chan_id] = asyncio.Future() self.shutdown_received[chan_id] = asyncio.Future()
self.send_shutdown(chan) self.send_shutdown(chan)
payload = await self.shutdown_received[chan_id] payload = await self.shutdown_received[chan_id]

Loading…
Cancel
Save