mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 16:31:29 +00:00
ln: add closechannel cli command
This commit is contained in:
parent
bd45f3f1c8
commit
6b6097a453
2 changed files with 10 additions and 1 deletions
|
@ -808,6 +808,14 @@ class Commands:
|
|||
def listinvoices(self):
|
||||
return "\n".join(self.wallet.lnworker.list_invoices())
|
||||
|
||||
@command('wn')
|
||||
def closechannel(self, channel_point, force=False):
|
||||
chan_id = bytes(reversed(bfh(channel_point)))
|
||||
if force:
|
||||
return self.network.run_from_another_thread(self.wallet.lnworker.force_close_channel(chan_id))
|
||||
else:
|
||||
return self.network.run_from_another_thread(self.wallet.lnworker.close_channel(chan_id))
|
||||
|
||||
def eval_bool(x: str) -> bool:
|
||||
if x == 'false': return False
|
||||
if x == 'true': return True
|
||||
|
|
|
@ -1180,7 +1180,8 @@ class Peer(PrintError):
|
|||
async def _shutdown(self, chan: Channel, payload):
|
||||
# set state so that we stop accepting HTLCs
|
||||
chan.set_state('CLOSING')
|
||||
while len(chan.htlcs(LOCAL, only_pending=True)) > 0:
|
||||
while len(chan.hm.htlcs_by_direction(LOCAL, RECEIVED)) > 0:
|
||||
self.print_error('waiting for htlcs to settle...')
|
||||
await asyncio.sleep(1)
|
||||
our_fee = chan.pending_local_fee()
|
||||
scriptpubkey = bfh(bitcoin.address_to_script(chan.sweep_address))
|
||||
|
|
Loading…
Add table
Reference in a new issue