commit 8a98810df15a78ef5d78ea3c4ea7a69a1bb98c19
parent 9cf7aa054d24b84c023fda1ed87a27dcb2b2a4e6
Author: Janus <ysangkok@gmail.com>
Date: Mon, 5 Nov 2018 18:48:00 +0100
do not co-op close channels with pending htlcs
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/electrum/lnbase.py b/electrum/lnbase.py
@@ -1152,6 +1152,8 @@ class Peer(PrintError):
@log_exceptions
async def close_channel(self, chan_id: bytes):
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.send_shutdown(chan)
payload = await self.shutdown_received[chan_id]